.dm-mypage .dm-collection-heading { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.dm-mypage .dm-collection-heading h2 { margin: 0; font-size: clamp(23px, 4vw, 29px); }
.dm-collection-count { background: #fff; border: 1px solid #b9dceb; padding: 5px 15px; border-radius: 999px; font-weight: 800; white-space: nowrap; }
.dm-mypage .dm-collection-lead { margin: 10px 0; font-weight: 700; }
.dm-mypage .dm-mypage-panel.dm-bookshelf { background: linear-gradient(130deg, #eefaff, #fffaf0 65%); border-color: #b9dceb; padding-bottom: 20px; }
/* Keep one row of spines even when every game has a learning record. */
.dm-books-sorting { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-top: 16px; }
.dm-books-sorting label { font-weight: 700; }
.dm-mypage .dm-books-sort { min-height: 44px; max-width: 100%; min-width: 0; padding: 8px 32px 8px 12px; border: 1px solid #8fc9e7; border-radius: 10px; background: #fff; color: #064782; font: inherit; }
.dm-book-grid { display: grid; grid-template-columns: repeat(var(--book-columns, 8), minmax(0, 72px)); gap: 6px; list-style: none; padding: 8px 8px 0; margin: 20px 0 14px; border-bottom: 12px solid #dbaf72; border-radius: 4px; box-shadow: 0 5px 0 #b88349, 0 10px 12px #916c3220; }
.dm-book-slot { min-width: 0; display: flex; }
.dm-mypage .dm-book { --book-color: #189cc1; --book-tint: #e2f5ff; display: flex; flex-direction: column; align-items: center; gap: 6px; width: 100%; height: 240px; min-width: 0; position: relative; border: 1px solid #81adc2; border-inline: 4px solid var(--book-color); border-radius: 7px 7px 2px 2px; padding: 10px 4px 6px; background: linear-gradient(90deg, #ffffffc9, transparent 30%, #ffffff91 83%, #254a5b14), var(--book-tint); color: #064782; font: inherit; cursor: pointer; touch-action: manipulation; box-shadow: 2px 0 3px #22516824; transition: transform .18s ease; }
.dm-mypage .dm-book[data-subject="math"] { --book-color: #128ed6; --book-tint: #e0f4ff; }
.dm-mypage .dm-book[data-subject="japanese"] { --book-color: #ce7744; --book-tint: #ffebda; }
.dm-mypage .dm-book[data-subject="science"] { --book-color: #199c84; --book-tint: #dff5e9; }
.dm-mypage .dm-book[data-subject="social"] { --book-color: #bd9020; --book-tint: #fff3c4; }
.dm-mypage .dm-book[data-subject="english"] { --book-color: #9471be; --book-tint: #f1e8ff; }
.dm-mypage .dm-book:hover { transform: translateY(-3px); }
.dm-mypage .dm-book[aria-expanded="true"] { outline: 3px solid #0068bd; outline-offset: 2px; transform: translateY(-5px); }
.dm-mypage .dm-book:focus-visible { outline: 3px solid #ab5900; outline-offset: 3px; }
.dm-book-count { color: #064782; background: #ffffffb8; border: 1px solid #ffffff; border-radius: 999px; padding: 2px 3px; font-size: .75rem; font-weight: 800; line-height: 1.2; white-space: nowrap; font-variant-numeric: tabular-nums; }
.dm-book-subject { font-size: .75rem; font-weight: 750; line-height: 1.4; }
.dm-book-title { writing-mode: vertical-rl; text-orientation: upright; height: 174px; max-width: 100%; overflow: hidden; overflow-wrap: anywhere; font-size: .875rem; font-weight: 800; line-height: 1.35; text-align: start; }
.dm-books-pager { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px; margin: 20px 0 8px; }
.dm-mypage .dm-books-pager button { padding: 8px 12px; min-height: 44px; font-size: .85rem; }
.dm-books-range { font-size: .8rem; font-variant-numeric: tabular-nums; }
.dm-book-detail { display: grid; grid-template-columns: minmax(0, 200px) minmax(0, 1fr); align-items: center; gap: 18px; margin-top: 20px; padding: 16px; border: 1px solid #91c6e1; border-radius: 14px; background: #fff; }
.dm-book-cover { display: block; position: relative; width: 100%; aspect-ratio: 8 / 5; overflow: hidden; border: 1px solid #deebed; background: #eaf8fc; border-radius: 4px; }
.dm-book-image { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #fff; }
.dm-book-cover-fallback { display: grid; place-items: center; height: 100%; color: #1881b6; font-weight: 800; }
.dm-mypage .dm-book-info h3 { margin: 4px 0 14px; font-size: 1.1rem; overflow-wrap: anywhere; }
.dm-mypage .dm-book-detail-subject { margin: 0; font-size: .8rem; }
.dm-mypage .dm-book-history-count { margin: 10px 0 0; font-size: .85rem; font-weight: 700; overflow-wrap: anywhere; }
.dm-mypage .dm-book-close { margin: 6px 0 0 6px; }
.dm-mypage .dm-books-explore { display: flex; align-items: center; justify-content: center; min-height: 48px; width: fit-content; margin: 12px auto 0; padding: 8px 16px; color: #0068bd; font-weight: 750; text-underline-offset: 4px; }
.dm-books-empty { text-align: center; padding: 24px 14px; background: #ffffffad; border: 2px dashed #b9dceb; border-radius: 16px; margin-top: 22px; }
.dm-empty-book { display: grid; place-items: center; width: 60px; height: 72px; border: 2px solid #71bbdb; border-left: 10px solid #44a8d3; border-radius: 4px 10px 10px 4px; margin: 0 auto 16px; background: #def5ff; font-weight: 800; font-size: 28px; box-shadow: 4px 4px #d3e8ef; }
.dm-mypage .dm-mypage-panel.dm-discovery-stamps { background: #fffdf5; border-color: #e5d3a9; }
.dm-stamp-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; margin-top: 22px; }
.dm-mypage .dm-stamp { display: flex; flex-direction: column; align-items: center; gap: 7px; border: 1px solid transparent; border-radius: 14px; background: transparent; padding: 10px 5px; font: inherit; color: #536276; cursor: pointer; touch-action: manipulation; }
.dm-stamp-seal { display: grid; place-items: center; width: 74px; height: 74px; border: 2px dashed #a4b1bb; border-radius: 50%; background: #f6f7f6; font: 800 30px/1 Georgia, serif; box-shadow: inset 0 0 0 5px #fff; }
.dm-stamp[data-earned="true"] .dm-stamp-seal { border: 3px double #087ab2; background: #dff6ff; color: #006495; box-shadow: inset 0 0 0 5px #f1fbff, 0 3px 0 #b4d6e4; transform: rotate(-8deg); }
.dm-stamp[data-earned="true"]:nth-child(2n) .dm-stamp-seal { background: #fff0b7; border-color: #a66f12; color: #895400; box-shadow: inset 0 0 0 5px #fff9e3, 0 3px 0 #e4d3a6; transform: rotate(6deg); }
.dm-stamp-title { font-size: .9rem; font-weight: 800; line-height: 1.5; }
.dm-stamp-status { font-size: .82rem; }
.dm-stamp[data-earned="true"] { color: #074a75; }
.dm-stamp[data-earned="true"] .dm-stamp-status { font-weight: 800; color: #006959; }
.dm-stamp-progress { margin-top: auto; font-size: .8rem; font-variant-numeric: tabular-nums; }
.dm-stamp:hover, .dm-stamp[aria-pressed="true"] { background: #fff; border-color: #c7dce6; }
.dm-stamp[data-earned="true"][aria-pressed="true"] .dm-stamp-seal { animation: dm-stamp-pop .28s ease-out; }
.dm-stamp-detail { background: #fff; border: 1px solid #e7dcc1; border-radius: 12px; padding: 12px 16px; }
@keyframes dm-stamp-pop { from { transform: scale(1.15) rotate(-12deg); } to { transform: scale(1) rotate(0); } }
@media (max-width: 800px) { .dm-stamp-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 600px) {
  .dm-mypage .dm-mypage-panel:is(.dm-bookshelf, .dm-discovery-stamps) { padding: 20px 14px; }
  .dm-book-grid { grid-template-columns: repeat(var(--book-columns, 4), minmax(0, 48px)); gap: 4px; padding-inline: 3px; }
  .dm-mypage .dm-book { border-inline-width: 3px; padding-inline: 2px; }
  .dm-book-title { width: 1.4em; white-space: nowrap; overflow-wrap: normal; text-overflow: ellipsis; }
  .dm-book-count { padding-inline: 0; font-size: .625rem; }
  .dm-book-detail { grid-template-columns: minmax(0, 1fr); gap: 12px; padding: 12px; }
  .dm-book-detail .dm-book-cover { max-width: 200px; margin: auto; }
}
@media (max-width: 360px) { .dm-stamp-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (prefers-reduced-motion: reduce) { .dm-book, .dm-stamp-seal { animation: none !important; transition: none !important; } }
