/* ════════════════════════════════════════════════════════
   カード図鑑（zukan）モーダル
   #replay-modal / #replay-box と同じ「ゲーム選択画面の上に被せる
   モーダル」パターン。ScreenManager の画面遷移は使わない（閉じる＝
   ゲーム選択画面に戻る、を自動的に満たすため）。
   ════════════════════════════════════════════════════════ */

#zukan-modal {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.62); z-index: 800;
  align-items: center; justify-content: center; padding: 16px;
}
#zukan-modal.open { display: flex; }

#zukan-box {
  background: #fff; border-radius: 24px;
  padding: 22px 18px 18px; width: 100%; max-width: 560px;
  max-height: 90vh; overflow-y: auto;
  animation: popIn .35s cubic-bezier(.34,1.56,.64,1);
}

#zukan-header {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 8px; margin-bottom: 10px;
}
#zukan-header h2 { font-size: 1.2rem; color: #e07b39; }
#zukan-progress { font-size: .82rem; color: #999; font-weight: bold; white-space: nowrap; }

#zukan-pack-tabs {
  display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px;
}
.zukan-tab {
  padding: 7px 14px; border-radius: 18px; border: 2px solid #eee;
  background: #fafafa; color: #777; font-family: inherit; font-size: .82rem;
  font-weight: bold; cursor: pointer; transition: .15s;
}
.zukan-tab.active {
  background: #fff3e8; border-color: var(--orange); color: var(--orange);
}

#zukan-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(86px, 1fr));
  gap: 10px;
  margin-bottom: 8px;
}
.zukan-empty { padding: 30px 10px; text-align: center; color: #aaa; font-size: .88rem; }

.zukan-card {
  display: flex; flex-direction: column; align-items: center;
  background: #f7f7f7; border-radius: 14px; padding: 7px 4px 7px;
  cursor: pointer; transition: transform .12s;
  border: 2px solid transparent;
}
.zukan-card:active { transform: scale(.94); }
.zukan-card.owned { background: #fffaf3; border-color: #ffe1bb; }

.zukan-card-imgwrap {
  width: 70px; height: 68px; display: flex; align-items: center; justify-content: center;
  margin-bottom: 5px;
}
.zukan-card-imgwrap img { max-width: 100%; max-height: 100%; object-fit: contain; }

/* 未所持カードはシルエット表示（同じ画像をフィルタで黒塗りにする。専用素材は不要） */
.zukan-card.unowned .zukan-card-imgwrap img {
  filter: brightness(0) opacity(.55);
}

.zukan-card-label {
  display: flex; align-items: center; justify-content: center; gap: 4px;
  font-size: .68rem; color: #555; text-align: center; line-height: 1.2;
  max-width: 100%; min-width: 0;
}
.zukan-card-difficulty-mark {
  width: 7px; height: 7px; flex: 0 0 7px; border-radius: 50%;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.08);
}
.zukan-card-name {
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.zukan-card.unowned .zukan-card-label { color: #bbb; }

.zukan-card-rarity {
  display: flex; justify-content: center; gap: 1px;
  font-size: .72rem; line-height: 1; margin-top: 4px; letter-spacing: 0;
}
.zukan-rarity-star {
  display: inline-block;
  font-family: inherit;
}
.zukan-rarity-star.filled {
  color: #ffd700;
  animation: zukanStarTwinkle 3.8s ease-in-out infinite;
}
.zukan-rarity-star.empty { color: #d8d8d8; }
.zukan-rarity-star.filled:nth-child(2) { animation-delay: .35s; }
.zukan-rarity-star.filled:nth-child(3) { animation-delay: .7s; }

@keyframes zukanStarTwinkle {
  0%, 72%, 100% {
    filter: none;
    text-shadow: none;
    transform: translateY(0) scale(1);
  }
  80% {
    filter: brightness(1.08);
    text-shadow: 0 0 4px rgba(255, 215, 0, .32);
    transform: translateY(-.5px) scale(1.03);
  }
  88% {
    filter: none;
    text-shadow: none;
    transform: translateY(0) scale(1);
  }
}

@media (prefers-reduced-motion: reduce) {
  .zukan-rarity-star.filled { animation: none; }
}

#zukan-close {
  width: 100%; margin-top: 10px; padding: 10px;
  background: #eee; color: #555; border: none; border-radius: 20px;
  font-family: inherit; font-size: .9rem; cursor: pointer; font-weight: bold;
}

/* ── カード拡大表示（zukan-modal の上にさらに重ねる） ── */
#zukan-detail {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.72); z-index: 850;
  align-items: center; justify-content: center; padding: 20px;
}
#zukan-detail.open { display: flex; }
#zukan-detail-box {
  background: #fff; border-radius: 22px; padding: 26px 22px 20px;
  width: 100%; max-width: 320px; text-align: center;
  animation: popIn .3s cubic-bezier(.34,1.56,.64,1);
}
#zukan-detail-img {
  width: 100%; max-height: 220px; object-fit: contain; margin-bottom: 14px;
}
.zukan-detail-effect-preview {
  margin: 0 auto 18px;
}
.zukan-detail-effect-preview .card-reward-ui-image-wrap {
  width: min(72vw, 250px);
  height: min(72vw, 250px);
  max-width: 250px;
  max-height: 250px;
}
#zukan-detail-name { font-size: 1.1rem; font-weight: bold; color: #444; margin-bottom: 6px; line-height: 1.3; }
#zukan-detail-description {
  color: #6b5b45;
  font-size: .88rem;
  font-weight: 600;
  line-height: 1.45;
  margin: 0 auto 8px;
  max-width: 260px;
  overflow: hidden;
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}
#zukan-detail-description:empty { display: none; }
#zukan-detail-rarity {
  display: flex; justify-content: center; gap: 2px;
  font-size: 1rem; line-height: 1; margin-bottom: 14px;
}
#zukan-detail-close {
  width: 100%; padding: 10px; background: var(--orange); color: #fff;
  border: none; border-radius: 20px; font-family: inherit; font-size: .9rem;
  cursor: pointer; font-weight: bold;
}
