/* ==========================================================================
   Cartes, dos de carte, sachets de booster.
   Tout est dimensionné en cqw (% de la largeur de la carte) : une carte
   s'affiche à n'importe quelle taille sans rien changer.
   ========================================================================== */
.card {
  --rc: #c9a878;
  --rt: #221d17;
  --mx: 50%;
  --my: 50%;
  --rx: 0deg;
  --ry: 0deg;
  --o: 0;
  position: relative;
  width: 100%;
  aspect-ratio: 63 / 88;
  container-type: inline-size;
  -webkit-user-select: none;
  user-select: none;
}

/* Cadre métallique dans la couleur de la rareté, légèrement gaufré */
.card-in {
  --rl: color-mix(in srgb, var(--rc), #fff 48%);
  --rd: color-mix(in srgb, var(--rc), #000 40%);
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  padding: 3.4cqw 3.4cqw 0;
  overflow: hidden;
  border: max(1px, 0.6cqw) solid #15110e;
  border-radius: 5.5cqw;
  color: #f6efe2;
  background:
    repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.09) 0 0.45cqw, transparent 0.45cqw 1.3cqw),
    linear-gradient(155deg, var(--rl) 0%, var(--rc) 28%, var(--rd) 62%, var(--rc) 84%, var(--rl) 100%);
  box-shadow:
    inset 0 0 0 0.5cqw rgba(255, 255, 255, 0.3),
    inset 0 1.2cqw 2cqw rgba(255, 255, 255, 0.18),
    inset 0 -1.6cqw 2.6cqw rgba(0, 0, 0, 0.3);
  transform: perspective(700px) rotateY(var(--rx)) rotateX(var(--ry));
  transition: transform 0.35s cubic-bezier(0.2, 0.8, 0.2, 1);
  isolation: isolate;
}
.card.tilting .card-in { transition: transform 0.08s linear; }
.card.idle .card-in { transition: none; }

/* Intérieur sombre */
.c-frame {
  position: relative;
  z-index: 1;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 1.9cqw;
  padding: 1.9cqw;
  overflow: hidden;
  border-radius: 3.2cqw;
  background: linear-gradient(180deg, #2b241e, #16120f);
  box-shadow:
    0 0 0 0.55cqw var(--rd),
    0 0.8cqw 1.4cqw rgba(0, 0, 0, 0.35),
    inset 0 0 0 0.35cqw rgba(255, 255, 255, 0.07);
}

/* Plaque du nom */
.c-head {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2cqw;
  padding: 1.5cqw 2.6cqw 1.3cqw;
  border-radius: 2cqw;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.02)), #231d18;
  box-shadow: inset 0 0 0 0.35cqw color-mix(in srgb, var(--rc), transparent 40%);
}
.c-name {
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font: 800 6.4cqw/1.25 var(--font);
  letter-spacing: -0.01em;
  color: #fbf4e6;
  text-shadow: 0 0.3cqw 0 rgba(0, 0, 0, 0.55);
}
.c-name.s { font-size: 5.5cqw; }
.c-name.xs { font-size: 4.7cqw; }

/* Pierres de rareté */
.c-pips { display: flex; gap: 1.6cqw; flex: none; padding-right: 0.8cqw; }
.c-pips i {
  width: 3cqw;
  height: 3cqw;
  transform: rotate(45deg);
  background: linear-gradient(135deg, #fff 0%, var(--rl) 22%, var(--rc) 55%, var(--rd) 100%);
  box-shadow: 0 0 1.4cqw color-mix(in srgb, var(--rc), transparent 30%), inset 0 0 0 0.3cqw rgba(0, 0, 0, 0.3);
}

/* Photo sertie */
.c-img {
  position: relative;
  flex: none;
  aspect-ratio: 5 / 4;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 1.8cqw;
  background: radial-gradient(circle at 50% 40%, #3a322a, #18140f);
  box-shadow: 0 0 0 0.45cqw var(--rl), 0 0 0 0.85cqw rgba(0, 0, 0, 0.55);
}
.c-img img { display: block; width: 100%; height: 100%; object-fit: cover; -webkit-user-drag: none; }
.c-img::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 1;
  border-radius: inherit;
  pointer-events: none;
  box-shadow: inset 0 0 3.5cqw rgba(0, 0, 0, 0.35), inset 0 0 0 0.3cqw rgba(255, 255, 255, 0.12);
}
.c-noimg { font: 800 22cqw/1 var(--font); color: rgba(255, 255, 255, 0.12); }

/* Description sur parchemin */
.c-desc {
  flex: 1;
  min-height: 0;
  display: flex;
  overflow: hidden;
  padding: 2.2cqw 3.6cqw;
  border-radius: 1.8cqw;
  background: linear-gradient(180deg, #fbf5e8, #eee1c4);
  box-shadow: inset 0 0 0 0.35cqw rgba(120, 90, 40, 0.28), inset 0 0.7cqw 1.2cqw rgba(255, 255, 255, 0.65);
  color: #3a2f22;
  font: italic 400 5.4cqw/1.22 var(--serif);
  text-align: center;
}
.c-desc p { width: 100%; margin: auto 0; overflow-wrap: break-word; }
.c-desc p:empty::before { content: '✦'; font-style: normal; color: rgba(120, 90, 40, 0.35); }
.c-desc.s { font-size: 4.8cqw; }
.c-desc.xs { font-size: 4.2cqw; }

/* Bas de carte, gravé dans le cadre */
.c-foot {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 2cqw;
  padding: 1.6cqw 1.4cqw 2cqw;
  font: 800 3.2cqw/1.3 var(--font);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--rt);
  white-space: nowrap;
  text-shadow: 0 0.2cqw 0 color-mix(in srgb, var(--rc), #fff 45%);
}
.c-col { overflow: hidden; text-overflow: ellipsis; }
.c-num { flex: none; }

/* --- Effets ------------------------------------------------------------- */
.c-fx, .c-glare { position: absolute; inset: 0; border-radius: inherit; pointer-events: none; }
.c-glare {
  z-index: 3;
  opacity: var(--o);
  background: radial-gradient(farthest-corner circle at var(--mx) var(--my), rgba(255, 255, 255, 0.55) 0%, rgba(255, 255, 255, 0.1) 32%, rgba(0, 0, 0, 0.22) 95%);
  mix-blend-mode: overlay;
  transition: opacity 0.3s;
}
.card.live { --o: 1; }

/* Reflet : un trait de lumière passe sur toute la carte */
.card[data-effect='shine'] .c-fx {
  z-index: 2;
  background: linear-gradient(105deg, transparent 38%, rgba(255, 255, 255, 0.75) 47%, rgba(255, 255, 255, 0.2) 52%, transparent 60%);
  background-size: 260% 100%;
  background-position: 130% 0;
  mix-blend-mode: soft-light;
  animation: c-shine 4.5s ease-in-out infinite paused;
}
@keyframes c-shine {
  0%, 50% { background-position: 130% 0; }
  80%, 100% { background-position: -30% 0; }
}

/* Holographique : arc-en-ciel qui suit le regard, sur le cadre et la photo (pas sur le texte) */
.card[data-effect='holo'] .c-fx {
  background:
    repeating-linear-gradient(115deg, #ff6b6b 0%, #ffd93b 6%, #6bff95 12%, #5ecbff 18%, #c06bff 24%, #ff6b6b 30%),
    repeating-linear-gradient(25deg, rgba(255, 255, 255, 0.3) 0 1.2cqw, transparent 1.2cqw 3cqw);
  background-size: 320% 320%, 100% 100%;
  background-position: var(--mx) var(--my), 0 0;
  mix-blend-mode: color-dodge;
  opacity: 0.6;
  filter: brightness(0.9) contrast(1.3) saturate(1.2);
}
.card[data-effect='holo'] .c-img::after,
.card[data-effect='gold'] .c-img::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background: repeating-linear-gradient(115deg, #ff6b6b 0%, #ffd93b 6%, #6bff95 12%, #5ecbff 18%, #c06bff 24%, #ff6b6b 30%);
  background-size: 320% 320%;
  background-position: var(--mx) var(--my);
  mix-blend-mode: color-dodge;
  opacity: 0.2;
}
.card[data-effect='gold'] .c-img::after { opacity: 0.13; }

/* Doré : cadre en or + étincelles */
.card[data-effect='gold'] .card-in {
  background:
    repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.12) 0 0.45cqw, transparent 0.45cqw 1.3cqw),
    linear-gradient(125deg, #9c7110 0%, #f2c94c 16%, #fff4c2 30%, #e2a72e 46%, #ffe183 62%, #b8860b 80%, #f6d36b 100%);
  background-size: 100% 100%, 220% 220%;
  background-position: 0 0, var(--mx) var(--my);
}
.card[data-effect='gold'] .c-fx {
  background: repeating-linear-gradient(115deg, #ffe9a6 0%, #ffd0f0 8%, #c9f4ff 16%, #fff1b3 24%, #ffe9a6 32%);
  background-size: 300% 300%;
  background-position: var(--mx) var(--my);
  mix-blend-mode: color-dodge;
  opacity: 0.35;
}
.card[data-effect='gold'] .c-glare::before,
.card[data-effect='gold'] .c-glare::after {
  content: '';
  position: absolute;
  width: 9cqw;
  height: 9cqw;
  background: #fff;
  clip-path: polygon(50% 0, 60% 40%, 100% 50%, 60% 60%, 50% 100%, 40% 60%, 0 50%, 40% 40%);
  animation: c-twinkle 2.4s ease-in-out infinite paused;
}
.card[data-effect='gold'] .c-glare::before { top: 3%; right: 6%; }
.card[data-effect='gold'] .c-glare::after { bottom: 7%; left: 4%; width: 6.5cqw; height: 6.5cqw; animation-delay: 1.2s; }
@keyframes c-twinkle {
  0%, 100% { transform: scale(0.2) rotate(0deg); opacity: 0; }
  45% { transform: scale(1) rotate(45deg); opacity: 1; }
  70% { transform: scale(0.5) rotate(90deg); opacity: 0.3; }
}

/* Les animations ne tournent qu'au survol, ou quand la carte est mise en avant */
.card:hover .c-fx, .card.live .c-fx,
.card.live .c-glare::before, .card.live .c-glare::after { animation-play-state: running; }

/* --- Dos de carte ------------------------------------------------------- */
.card-back {
  position: relative;
  width: 100%;
  aspect-ratio: 63 / 88;
  container-type: inline-size;
}
.cb-inner {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: max(1px, 0.6cqw) solid #15110e;
  border-radius: 5.5cqw;
  background:
    radial-gradient(circle at 50% 50%, rgba(255, 214, 120, 0.28), transparent 55%),
    repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.08) 0 1.6cqw, transparent 1.6cqw 3.2cqw),
    repeating-linear-gradient(-45deg, rgba(0, 0, 0, 0.12) 0 1.6cqw, transparent 1.6cqw 3.2cqw),
    linear-gradient(160deg, #f0573a 0%, #b32d17 60%, #7e1d0e 100%);
  box-shadow:
    inset 0 0 0 2.4cqw #1c1612,
    inset 0 0 0 3cqw #d9b35a,
    inset 0 0 0 3.6cqw #1c1612,
    inset 0 0 7cqw rgba(0, 0, 0, 0.5);
}
.cb-emblem {
  width: 62cqw;
  aspect-ratio: 1.15;
  display: grid;
  place-items: center;
  border: max(1px, 0.7cqw) solid #1c1612;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff6d4 0%, #f0cd6e 35%, #c4952f 70%, #8a6416 100%);
  box-shadow:
    0 0 0 1.4cqw rgba(28, 22, 18, 0.55),
    inset 0 0.6cqw 0 rgba(255, 255, 255, 0.5),
    inset 0 -0.8cqw 1.4cqw rgba(0, 0, 0, 0.25),
    0 1.4cqw 2.4cqw rgba(0, 0, 0, 0.35);
  transform: rotate(-8deg);
}
.cb-emblem span {
  padding: 0 7cqw;
  font: 800 8.4cqw/0.95 var(--font);
  letter-spacing: -0.02em;
  text-align: center;
  text-transform: uppercase;
  color: #2a1d0c;
  text-shadow: 0 0.3cqw 0 rgba(255, 255, 255, 0.45);
  overflow-wrap: anywhere;
}

/* --- Sachet de booster ------------------------------------------------- */
.pack {
  --pc: #ff5a36;
  --pt: #fff;
  position: relative;
  width: 100%;
  aspect-ratio: 5 / 8;
  container-type: inline-size;
  filter:
    drop-shadow(1.5px 0 0 #221d17) drop-shadow(-1.5px 0 0 #221d17)
    drop-shadow(0 1.5px 0 #221d17) drop-shadow(0 -1.5px 0 #221d17)
    drop-shadow(5px 6px 0 #221d17);
}
.pack-part { position: absolute; inset: 0; }
.pack-face { position: absolute; inset: 0; overflow: hidden; background: var(--pc); }
.pack-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; -webkit-user-drag: none; }
.pack-dots {
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(255, 255, 255, 0.24) 1.3cqw, transparent 1.5cqw);
  background-size: 6.5cqw 6.5cqw;
  -webkit-mask-image: linear-gradient(165deg, #000 5%, transparent 62%);
  mask-image: linear-gradient(165deg, #000 5%, transparent 62%);
}
.pack-dots::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(0, 0, 0, 0.16) 1.3cqw, transparent 1.5cqw);
  background-size: 6.5cqw 6.5cqw;
  background-position: 3.25cqw 3.25cqw;
  -webkit-mask-image: linear-gradient(-15deg, #000 10%, transparent 60%);
  mask-image: linear-gradient(-15deg, #000 10%, transparent 60%);
}
.pack-label {
  position: absolute;
  left: 9cqw;
  right: 9cqw;
  top: 47%;
  display: grid;
  gap: 2.2cqw;
  padding: 6cqw 5cqw 5.5cqw;
  border: 1.4cqw solid #221d17;
  border-radius: 4cqw;
  background: #fbf7ee;
  box-shadow: 2.4cqw 2.4cqw 0 #221d17;
  text-align: center;
  transform: translateY(-50%) rotate(-4deg);
}
.pack-img ~ .pack-label { top: auto; bottom: 12%; transform: rotate(-3deg); padding: 4cqw 5cqw; }
.pack-label small {
  font: 700 4.6cqw/1.25 var(--font);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #5f5546;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pack-label strong { font: 800 11.5cqw/0.95 var(--font); letter-spacing: -0.03em; color: #221d17; overflow-wrap: anywhere; }
.pack-label em { font: italic 400 7cqw/1 var(--serif); color: #5f5546; }
.pack-crimp {
  position: absolute;
  left: 0;
  right: 0;
  height: 7%;
  background: repeating-linear-gradient(90deg, rgba(0, 0, 0, 0.2) 0 1.1cqw, rgba(255, 255, 255, 0.2) 1.1cqw 2.2cqw);
}
.pack-crimp.top { top: 0; border-bottom: 0.6cqw solid rgba(0, 0, 0, 0.18); }
.pack-crimp.bottom { bottom: 0; border-top: 0.6cqw solid rgba(0, 0, 0, 0.18); }
.pack-foil {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(115deg, transparent 18%, rgba(255, 255, 255, 0.42) 34%, transparent 48%, transparent 68%, rgba(255, 255, 255, 0.2) 78%, transparent 88%);
  mix-blend-mode: soft-light;
}

@media (prefers-reduced-motion: reduce) {
  .c-fx, .c-glare::before, .c-glare::after { animation: none !important; }
}
