.donki-library {
  padding: 90px clamp(22px, 5vw, 80px);
  border-block: 3px solid var(--ink);
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.76), rgba(255, 255, 255, 0.92)),
    repeating-linear-gradient(135deg, var(--pink) 0 18px, var(--acid) 18px 36px);
}

.donki-library-head {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(300px, 0.8fr);
  gap: clamp(30px, 6vw, 90px);
  align-items: end;
  margin-bottom: 48px;
}

.donki-library h2 {
  margin: 12px 0 0;
  font-size: clamp(3.3rem, 8vw, 8rem);
  letter-spacing: -0.065em;
}

.donki-library h2 i {
  color: var(--hot);
}

.donki-library-intro {
  font: 1.15rem/1.5 "Libre Caslon Display", serif;
}

.library-legal {
  padding: 16px;
  border: 3px solid var(--ink);
  background: var(--acid);
  box-shadow: 7px 7px 0 var(--pink);
  font: 800 0.78rem/1.5 "DM Mono", monospace;
  letter-spacing: 0.035em;
}

.library-legal strong {
  color: #b00051;
}

.library-controls {
  margin-bottom: 24px;
  border: 3px solid var(--ink);
  background: #fff;
  box-shadow: 7px 7px 0 var(--pink);
}

.library-controls-head {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 12px 15px;
  border-bottom: 2px solid var(--ink);
  font: 800 0.72rem/1.3 "DM Mono", monospace;
  letter-spacing: 0.08em;
}

.library-controls-head span { color: #8b496f; text-align: right; }

.library-category-rail {
  display: flex;
  gap: 9px;
  overflow-x: auto;
  padding: 12px;
  scrollbar-color: var(--pink) var(--paper);
  scrollbar-width: thin;
}

.library-category {
  flex: 0 0 auto;
  min-height: 42px;
  padding: 9px 12px;
  border: 2px solid var(--ink);
  border-radius: 0;
  background: var(--paper);
  color: var(--ink);
  font: 900 0.72rem/1 "DM Mono", monospace;
  letter-spacing: 0.06em;
  cursor: pointer;
  box-shadow: 3px 3px 0 var(--ink);
}

.library-category small { margin-left: 4px; color: #8b496f; }

.library-category:hover,
.library-category:focus-visible,
.library-category.is-active {
  outline: none;
  background: var(--pink);
  color: #13091a;
  transform: translate(2px, 2px);
  box-shadow: 1px 1px 0 var(--ink);
}

.library-category.is-active small { color: #13091a; }

.donki-library-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 24px;
}

.donki-library-grid.is-carousel {
  display: flex;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  scroll-snap-type: inline mandatory;
  padding: 4px 8px 16px 4px;
  scrollbar-color: var(--pink) var(--paper);
  scrollbar-width: auto;
}

.donki-library-grid.is-carousel .library-book {
  flex: 0 0 clamp(220px, 23vw, 310px);
  scroll-snap-align: start;
}

.library-book {
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-width: 0;
  border: 2px solid var(--ink);
  background: #fff;
  color: var(--ink);
  text-decoration: none;
  box-shadow: 7px 7px 0 var(--ink);
  transition: 0.16s transform, 0.16s box-shadow;
}

.library-book:hover,
.library-book:focus-visible {
  transform: translate(4px, 4px);
  box-shadow: 3px 3px 0 var(--ink);
  outline: 3px solid var(--pink);
  outline-offset: 3px;
}

.library-cover {
  position: relative;
  aspect-ratio: 4 / 5.8;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
  padding: 18px 16px;
  border-bottom: 2px solid var(--ink);
  background:
    linear-gradient(150deg, transparent 0 58%, rgba(255, 255, 255, 0.18) 58% 63%, transparent 63%),
    var(--cover);
  color: var(--cover-ink, #fff);
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.22);
}

.library-cover::after {
  content: "VD / READ";
  position: absolute;
  right: -31px;
  bottom: 28px;
  width: 130px;
  padding: 4px 0;
  transform: rotate(-90deg);
  border-block: 1px solid currentColor;
  font-size: 0.58rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-align: center;
  opacity: 0.66;
}

.library-cover small {
  font-size: 0.63rem;
  font-weight: 800;
  letter-spacing: 0.14em;
}

.library-cover strong {
  max-width: 88%;
  font: clamp(1.1rem, 2.1vw, 1.8rem)/0.96 "Archivo Black", sans-serif;
  text-transform: uppercase;
  letter-spacing: -0.045em;
}

.library-book-copy {
  padding: 16px;
}

.library-book-copy b,
.library-book-copy span {
  display: block;
}

.library-book-copy b {
  font-family: "Archivo Black", sans-serif;
  line-height: 1.05;
}

.library-book-copy span {
  margin-top: 6px;
  color: #6c5369;
  font-size: 0.72rem;
}

.library-book-copy p {
  margin: 12px 0 0;
  font-size: 0.82rem;
  line-height: 1.45;
}

.library-buy {
  padding: 12px 16px;
  border-top: 1px solid #c7b9c4;
  background: var(--paper);
  color: #9d0059;
  font-size: 0.7rem;
  font-weight: 900;
  letter-spacing: 0.08em;
}

@media (max-width: 1050px) {
  .donki-library-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
  .donki-library { padding-block: 64px; }
  .donki-library-head { grid-template-columns: 1fr; }
  .donki-library-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 15px; }
  .library-cover { padding: 14px 12px; }
  .library-book-copy { padding: 13px; }
  .library-controls-head { align-items: flex-start; flex-direction: column; gap: 4px; }
  .library-controls-head span { text-align: left; }
  .donki-library-grid.is-carousel .library-book { flex-basis: min(72vw, 290px); }
}

@media (max-width: 420px) {
  .donki-library-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .library-cover strong { font-size: 1rem; }
  .library-book-copy p { font-size: 0.74rem; }
  .library-buy { padding: 10px 12px; }
}
