.pta-mag {
  --navy: #0e2a30;
  --ink: #1a1a1a;
  --muted: #5c6568;
  --paper: #f4efe8;
  --card: #fffdf9;
  --shadow: 0 18px 40px rgba(14, 42, 48, 0.12);
  box-sizing: border-box;
  background: linear-gradient(180deg, #f7f1e8 0%, #efe6d8 100%);
  color: var(--ink);
  padding: 14px 12px 22px;
  margin: 0 0 28px;
  border-radius: 12px;
  font-family: "Segoe UI", Arial, Helvetica, sans-serif;
}
.pta-mag *,
.pta-mag *::before,
.pta-mag *::after { box-sizing: border-box; }
.pta-mag a { color: inherit; text-decoration: none; box-shadow: none; }
.pta-mag p { margin: 0; }

.pta-mag .shelf-card {
  background: var(--card);
  border-radius: 22px;
  box-shadow: var(--shadow);
  padding: 22px 22px 18px;
  margin: 0;
  border: 1px solid rgba(139, 90, 60, 0.12);
}

.pta-mag .shelf-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 18px;
}
.pta-mag .shelf-card h2 {
  margin: 0;
  font-size: 20px;
  color: var(--navy);
  font-weight: 700;
  line-height: 1.2;
}
.pta-mag .year-filter {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--navy);
  white-space: nowrap;
  font-weight: 500;
  margin: 0;
}
.pta-mag .year-filter select {
  font-size: 14px;
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid rgba(14, 42, 48, 0.2);
  background: #fff;
  color: var(--navy);
}
.pta-mag .book[hidden] { display: none !important; }

.pta-mag .shelf-row {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 14px;
  align-items: end;
  min-height: 220px;
  padding: 8px 8px 0;
}

.pta-mag .book {
  display: block;
  color: inherit;
  perspective: 700px;
}

.pta-mag .book-cover { position: relative; }
.pta-mag .book-actions {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px;
  background: rgba(14, 42, 48, 0.82);
  border-radius: 3px 8px 8px 3px;
  opacity: 0;
  pointer-events: none;
  transform: rotateY(-8deg);
  transform-origin: left center;
  transition: transform 0.25s ease, opacity 0.2s ease;
}
.pta-mag .book:hover .book-actions,
.pta-mag .book:focus-within .book-actions {
  opacity: 1;
  pointer-events: auto;
  transform: rotateY(0deg) translateY(-10px);
}
.pta-mag .book-actions a {
  display: inline-block;
  width: 100%;
  max-width: 150px;
  text-align: center;
  text-decoration: none;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
  color: #0e2a30 !important;
  background: #f4efe8 !important;
  border: 1px solid rgba(14, 42, 48, 0.12);
  border-radius: 999px;
  padding: 8px 10px;
}
.pta-mag .book-actions a:hover,
.pta-mag .book-actions a:focus {
  color: #f4efe8 !important;
  background: #0e2a30 !important;
  border-color: #0e2a30;
}

.pta-mag .book-face {
  position: relative;
  height: auto;
  aspect-ratio: 5 / 7;
  border-radius: 3px 8px 8px 3px;
  overflow: hidden;
  background: #2b1d16;
  box-shadow:
    4px 8px 18px rgba(0, 0, 0, 0.22),
    inset -8px 0 12px rgba(0, 0, 0, 0.18);
  transform: rotateY(-8deg);
  transform-origin: left center;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.pta-mag .book:hover .book-face,
.pta-mag .book:focus-within .book-face {
  transform: rotateY(0deg) translateY(-10px);
  box-shadow: 8px 16px 28px rgba(0, 0, 0, 0.28);
}
.pta-mag .book-face canvas,
.pta-mag .book-face img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  display: block;
  background: #fff;
}

.pta-mag .book-fallback {
  height: 100%;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  color: #f6efe6;
  background: linear-gradient(160deg, #3d2a22, #1f1511);
}
.pta-mag .book-fallback strong {
  font-size: 14px;
  line-height: 1.3;
}
.pta-mag .book-fallback span {
  font-size: 11px;
  opacity: 0.8;
}

.pta-mag .book-caption {
  margin-top: 8px;
  font-size: 12px;
  line-height: 1.35;
  color: var(--navy);
  text-align: center;
  min-height: 36px;
}

@media (max-width: 1100px) {
  .pta-mag .shelf-row { grid-template-columns: repeat(3, 1fr); gap: 16px; }
}
@media (max-width: 720px) {
  .pta-mag { padding: 10px 8px 18px; }
  .pta-mag .shelf-card { padding: 16px 14px 12px; border-radius: 16px; }
  .pta-mag .shelf-card h2 { font-size: 18px; }
  .pta-mag .shelf-head { flex-wrap: wrap; }
  .pta-mag .shelf-row { grid-template-columns: repeat(2, 1fr); gap: 12px; min-height: 0; padding: 0; }
  .pta-mag .book-caption { font-size: 11px; min-height: 32px; }
}
@media (hover: none) {
  .pta-mag .book-actions {
    opacity: 1;
    pointer-events: auto;
    transform: none;
    background: rgba(14, 42, 48, 0.72);
  }
  .pta-mag .book-face { transform: none; }
}
