/* ============ COLLECTION BUTTON ============ */
.collection-btn {
  position: absolute;
  top: 20px; left: 20px;
  font-family: 'Cinzel', serif;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.28em;
  color: #fff;
  background: linear-gradient(135deg, #2a2f60 0%, #4a3d8c 50%, #7c3d8c 100%);
  border: none;
  border-radius: 999px;
  padding: 11px 22px;
  cursor: pointer;
  box-shadow:
    0 0 0 1px rgba(255,255,255,0.18) inset,
    0 0 0 3px rgba(140,180,255,0.15),
    0 8px 28px -6px rgba(120,80,255,0.55);
  transition: transform 0.15s ease, box-shadow 0.25s ease;
  z-index: 55;
  overflow: hidden;
}
.collection-btn::before {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(120deg, transparent 30%, rgba(255,255,255,0.28) 50%, transparent 70%);
  transform: translateX(-100%);
  animation: btnShine 4s ease-in-out infinite;
}
.collection-btn:hover {
  transform: translateY(-2px);
  box-shadow:
    0 0 0 1px rgba(255,255,255,0.28) inset,
    0 0 0 3px rgba(180,200,255,0.22),
    0 12px 36px -6px rgba(160,100,255,0.8);
}
.collection-btn:active {
  transform: translateY(1px) scale(0.97);
}

/* ============ OVERLAY ============ */
.collection-overlay {
  position: fixed;
  inset: 0;
  background: rgba(4, 4, 12, 0.82);
  backdrop-filter: blur(6px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}
.collection-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

/* ============ MODAL ============ */
.collection-modal {
  position: relative;
  width: min(720px, 92vw);
  max-height: 82vh;
  background: linear-gradient(160deg, #0e0e24 0%, #181830 60%, #1a0e28 100%);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 20px;
  box-shadow:
    0 0 0 1px rgba(255,255,255,0.06) inset,
    0 40px 120px -20px rgba(0,0,0,0.9);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ============ HEADER ============ */
.collection-header {
  display: flex;
  align-items: center;
  padding: 20px 24px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  flex-shrink: 0;
  gap: 12px;
}
.collection-title {
  font-family: 'Cinzel', serif;
  font-weight: 900;
  font-size: 18px;
  letter-spacing: 0.3em;
  background: linear-gradient(180deg, #fff 30%, #aab 95%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  flex: 1;
}
.collection-reset-btn {
  font-family: 'RocknRoll One', sans-serif;
  font-size: 11px;
  letter-spacing: 0.12em;
  color: rgba(255, 120, 120, 0.75);
  background: rgba(255, 80, 80, 0.08);
  border: 1px solid rgba(255, 80, 80, 0.2);
  border-radius: 999px;
  padding: 6px 14px;
  cursor: pointer;
  transition: color 0.2s, background 0.2s;
}
.collection-reset-btn:hover {
  color: #ff8080;
  background: rgba(255, 80, 80, 0.18);
}
.collection-close-btn {
  font-family: 'Cinzel', serif;
  font-size: 16px;
  color: rgba(255,255,255,0.45);
  background: none;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 50%;
  width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
  flex-shrink: 0;
}
.collection-close-btn:hover {
  color: #fff;
  border-color: rgba(255,255,255,0.35);
}

/* ============ CONTENT AREA ============ */
.collection-content {
  overflow-y: auto;
  padding: 20px 24px 28px;
  flex: 1;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.15) transparent;
}
.collection-content::-webkit-scrollbar { width: 4px; }
.collection-content::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 4px; }

.collection-empty {
  text-align: center;
  font-family: 'RocknRoll One', sans-serif;
  font-size: 14px;
  letter-spacing: 0.2em;
  color: rgba(255,255,255,0.3);
  padding: 48px 0;
}

/* ============ SECTIONS ============ */
.collection-section { margin-bottom: 28px; }
.collection-section:last-child { margin-bottom: 0; }

.collection-section-title {
  font-family: 'Cinzel', serif;
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.4em;
  text-transform: uppercase;
  margin-bottom: 12px;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.collection-section-title.normal   { color: var(--c-normal-2); }
.collection-section-title.rare     { color: var(--c-rare-2); }
.collection-section-title.super    { color: var(--c-super-2); }
.collection-section-title.infinite {
  background: linear-gradient(90deg, var(--c-inf-1), var(--c-inf-2), var(--c-inf-3), var(--c-inf-4), var(--c-inf-1));
  background-size: 200% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: rainbowShift 4s linear infinite;
}

/* ============ GRID & MINI CARD ============ */
.collection-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.mini-card {
  position: relative;
  width: 90px;
  border-radius: 8px;
  padding: 8px 6px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  cursor: default;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.mini-card:hover { transform: translateY(-3px); }

.mini-card.normal {
  background: linear-gradient(180deg, #4a5260 0%, #2a3040 100%);
  box-shadow:
    0 0 0 1px var(--c-normal-1) inset,
    0 0 0 3px #1a1f2a inset,
    0 6px 18px -4px rgba(0,0,0,0.6);
}
.mini-card.rare {
  background: linear-gradient(180deg, #1a3a7a 0%, #0a1f4a 100%);
  box-shadow:
    0 0 0 1px var(--c-rare-2) inset,
    0 0 0 3px #0a1f4a inset,
    0 0 16px -2px var(--c-rare-1),
    0 6px 18px -4px rgba(0,30,100,0.6);
}
.mini-card.super {
  background: linear-gradient(180deg, #5e3a0a 0%, #2e1d05 100%);
  box-shadow:
    0 0 0 1px var(--c-super-2) inset,
    0 0 0 3px #2a1a05 inset,
    0 0 20px -2px var(--c-super-1),
    0 6px 18px -4px rgba(120,60,0,0.6);
}
.mini-card.infinite {
  background: linear-gradient(180deg, #1a0a2e 0%, #0a0a1f 50%, #2a0a1f 100%);
  box-shadow:
    0 0 0 1px #fff inset,
    0 0 0 3px #1a0a2e inset,
    0 0 24px -2px var(--c-inf-1),
    0 0 40px -8px var(--c-inf-2);
}

.mini-card-art {
  font-size: 38px;
  line-height: 1;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,0.6));
}
.mini-card-name {
  font-family: 'RocknRoll One', sans-serif;
  font-size: 9px;
  letter-spacing: 0.04em;
  color: rgba(255,255,255,0.9);
  text-align: center;
  word-break: break-all;
  line-height: 1.3;
}

/* Count badge */
.mini-card-count {
  position: absolute;
  top: 4px; right: 4px;
  font-family: 'Cinzel', serif;
  font-size: 9px;
  font-weight: 700;
  color: #fff;
  background: rgba(0,0,0,0.55);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 999px;
  padding: 1px 5px;
  line-height: 1.4;
}

/* ============ CARD DETAIL OVERLAY ============ */
.card-detail-overlay {
  position: fixed;
  inset: 0;
  background: rgba(4, 4, 12, 0.78);
  backdrop-filter: blur(6px);
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}
.card-detail-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.card-detail-wrap {
  position: relative;
  /* no fixed dimensions — sized by the card-container inside */
}

/* Override base .card-container rules for the detail context (only when overlay is open) */
.card-detail-overlay.open .card-detail-wrap .card-container {
  position: relative; /* take up space so wrap grows around it */
  pointer-events: auto !important;
  animation: cardDetailIn 0.4s cubic-bezier(.2,.9,.3,1) forwards;
}
@keyframes cardDetailIn {
  from { transform: scale(0.78) translateY(20px); opacity: 0; }
  to   { transform: scale(1)    translateY(0);    opacity: 1; }
}

/* ============ SPELL MINI-CARD ============ */
.mini-card.spell.normal {
  background: linear-gradient(180deg, #1e3028 0%, #0c1810 100%);
  box-shadow:
    0 0 0 1px rgba(100, 200, 100, 0.5) inset,
    0 0 0 3px #0c1810 inset,
    0 6px 18px -4px rgba(0,0,0,0.6);
}
.mini-card.spell.rare {
  background: linear-gradient(180deg, #0a2a38 0%, #051420 100%);
  box-shadow:
    0 0 0 1px rgba(60, 200, 220, 0.65) inset,
    0 0 0 3px #051420 inset,
    0 0 16px -2px rgba(60, 200, 220, 0.4),
    0 6px 18px -4px rgba(0,40,60,0.6);
}
.mini-card.spell.super {
  background: linear-gradient(180deg, #380a0a 0%, #1c0404 100%);
  box-shadow:
    0 0 0 1px rgba(220, 80, 80, 0.65) inset,
    0 0 0 3px #1c0404 inset,
    0 0 20px -2px rgba(220, 80, 80, 0.4),
    0 6px 18px -4px rgba(80,0,0,0.6);
}
.mini-card.spell.infinite {
  background: linear-gradient(180deg, #1a0a2e 0%, #0a0a1f 50%, #2a0a1f 100%);
  box-shadow:
    0 0 0 1px rgba(255, 100, 255, 0.55) inset,
    0 0 0 3px #1a0a2e inset,
    0 0 24px -2px var(--c-inf-1),
    0 0 40px -8px var(--c-inf-2);
}

.mini-spell-badge {
  font-family: 'RocknRoll One', sans-serif;
  font-size: 8px;
  letter-spacing: 0.1em;
  border-radius: 4px;
  padding: 1px 5px;
  margin-top: 1px;
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.15);
  color: rgba(255,255,255,0.65);
}
.mini-card.spell.normal .mini-spell-badge { color: rgba(120,220,120,0.85); border-color: rgba(100,200,100,0.3); }
.mini-card.spell.rare   .mini-spell-badge { color: rgba(60,220,235,0.85);  border-color: rgba(60,200,220,0.3);  }
.mini-card.spell.super  .mini-spell-badge { color: rgba(235,90,90,0.85);   border-color: rgba(220,80,80,0.3);   }
.mini-card.spell.infinite .mini-spell-badge {
  background: linear-gradient(90deg, var(--c-inf-1), var(--c-inf-2), var(--c-inf-3));
  -webkit-background-clip: text; background-clip: text; color: transparent;
  border-color: rgba(255,255,255,0.2);
}
