/* =========================================================================
 * cartes.css — Cartes à collectionner : carte, cadres métalliques, effets, ouverture de booster, collection
 * Effets coupés par body.no-fx (réglage parent « Réduire les animations ») et prefers-reduced-motion.
 * Largeur téléphone → tablette : aucun défilement horizontal.
 * ========================================================================= */

/* ---------------- La carte (format 3:4, tout est proportionnel à sa largeur) ---------------- */
.carte {
  --cw: 170px; position: relative; width: var(--cw); max-width: 100%; aspect-ratio: 3 / 4; flex: none;
  container-type: inline-size; border-radius: 7% / 5.25%; user-select: none; -webkit-user-select: none;
  box-shadow: 0 6px 14px rgba(30, 24, 70, .28); background: #2a2350; isolation: isolate;
}
.carte.s-xs { --cw: 78px; } .carte.s-sm { --cw: 128px; } .carte.s-md { --cw: 176px; }
.carte.s-lg { --cw: 250px; } .carte.s-xl { --cw: min(72vw, 330px); }
.carte-art { position: absolute; inset: 3.75% 5%; z-index: 1; border-radius: 4.2cqw; overflow: hidden; background: #e9e6f5; display: grid; place-items: center; }
.carte-img { width: 100%; height: 100%; object-fit: cover; display: block; pointer-events: none; }
.carte-frame { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 3; pointer-events: none; filter: drop-shadow(0 0 .6cqw rgba(0, 0, 0, .35)); }
.carte-draft { font-size: 7cqw; line-height: 1.2; text-align: center; color: #5b5680; font-weight: 700; padding: 0 6cqw; }
.carte.draft .carte-art { background: repeating-linear-gradient(45deg, #efeaff 0 3cqw, #e3dcfa 3cqw 6cqw); }
.carte-q { font-size: 32cqw; font-weight: 700; color: #9a94c0; }

/* Plaques de texte : sombres et opaques, TOUJOURS au-dessus du reflet (contraste ≥ 12:1 sur tous les cadres) */
.carte-plate { position: absolute; z-index: 5; left: 7%; right: 7%; color: #fff; background: rgba(14, 12, 36, .78); border-radius: 3cqw; padding: 1.6cqw 3cqw; backdrop-filter: blur(2px); }
.carte-top { top: 5.6%; display: flex; flex-direction: column; gap: .4cqw; }
.carte-nom { font-size: 6.4cqw; line-height: 1.12; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; letter-spacing: .1px; }
.carte-meta { display: flex; justify-content: space-between; gap: 2cqw; font-size: 3.7cqw; font-style: normal; opacity: .95; }
.carte-meta i { font-style: normal; }
.carte-rar { text-transform: uppercase; font-weight: 700; letter-spacing: .3px; }
.carte-bottom { bottom: 5.2%; padding: 1.8cqw 3cqw 1.6cqw; }
.carte-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1cqw; text-align: center; }
.carte-stats span { display: flex; flex-direction: column; line-height: 1.05; }
.carte-stats small { font-size: 3cqw; opacity: .8; font-weight: 600; }
.carte-stats b { font-size: 6.2cqw; font-variant-numeric: tabular-nums; }
.carte-serie { margin-top: .8cqw; font-size: 3.2cqw; text-align: center; opacity: .85; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.carte-count {
  position: absolute; z-index: 6; top: -2%; right: -2%; min-width: 9cqw; padding: 0 2.4cqw; height: 9cqw; border-radius: 99px; display: grid; place-items: center;
  background: var(--primary); color: #fff; font-weight: 700; font-size: 5cqw; border: .8cqw solid #fff; box-shadow: 0 2px 4px rgba(0, 0, 0, .25);
}
.carte.locked { filter: grayscale(1) brightness(.62); box-shadow: none; }
.carte.locked .carte-art { background: #cfcbe3; }

/* ---------------- Effets par rareté ---------------- */
.carte-shine { position: absolute; inset: 3.75% 5%; z-index: 2; border-radius: 4.2cqw; overflow: hidden; pointer-events: none; opacity: 0; }
.carte-shine::before { content: ''; position: absolute; inset: -20%; background-size: 260% 100%; background-position: 130% 0; }
/* basique / normal : cadre uni, aucun effet */
/* forte — cuivre : reflet doux qui défile lentement */
.f-cuivre .carte-shine { opacity: 1; }
.f-cuivre .carte-shine::before { background-image: linear-gradient(115deg, transparent 38%, rgba(255, 214, 170, .32) 50%, transparent 62%); animation: carteSweep 7s linear infinite; }
/* légendaire — argent : reflet plus marqué au survol ou au glissement + léger halo */
.f-argent { box-shadow: 0 0 .5cqw rgba(0, 0, 0, .3), 0 0 5cqw rgba(214, 226, 245, .65), 0 6px 14px rgba(30, 24, 70, .28); }
.f-argent .carte-shine { opacity: .55; transition: opacity .25s; }
.f-argent .carte-shine::before { background-image: linear-gradient(115deg, transparent 36%, rgba(255, 255, 255, .55) 50%, transparent 64%); animation: carteSweep 5s linear infinite; }
.f-argent:hover .carte-shine, .f-argent:active .carte-shine, .boo-card:active .f-argent .carte-shine { opacity: 1; }
/* ultra légendaire — or : reflet fort + effet holographique discret, animation continue */
.f-or { box-shadow: 0 0 .5cqw rgba(0, 0, 0, .3), 0 0 6cqw rgba(255, 200, 60, .55), 0 6px 14px rgba(30, 24, 70, .28); animation: carteGlow 3.4s ease-in-out infinite; }
.f-or .carte-shine { opacity: 1; }
.f-or .carte-shine::before { background-image: linear-gradient(115deg, transparent 34%, rgba(255, 244, 190, .7) 50%, transparent 66%); animation: carteSweep 3.2s linear infinite; }
.carte-holo {
  position: absolute; inset: 3.75% 5%; z-index: 2; border-radius: 4.2cqw; pointer-events: none; mix-blend-mode: soft-light; opacity: .42;
  background: linear-gradient(120deg, #ff6ec7, #ffd86e, #7dff9b, #6ec9ff, #c58bff, #ff6ec7); background-size: 300% 300%; animation: carteHolo 7s ease-in-out infinite;
}
@keyframes carteSweep { from { background-position: 130% 0; } to { background-position: -30% 0; } }
@keyframes carteHolo { 0%, 100% { background-position: 0% 50%; filter: hue-rotate(0deg); } 50% { background-position: 100% 50%; filter: hue-rotate(60deg); } }
@keyframes carteGlow { 50% { box-shadow: 0 0 .5cqw rgba(0, 0, 0, .3), 0 0 9cqw rgba(255, 210, 80, .8), 0 6px 14px rgba(30, 24, 70, .28); } }
/* Effets désactivés : réglage parent « Réduire les animations » et préférence du système */
body.no-fx .carte, body.no-fx .carte *, body.no-fx .boo-overlay *, body.no-fx .boo-overlay { animation: none !important; transition: none !important; }
body.no-fx .carte-shine::before { background-position: 50% 0; }
body.no-fx .f-argent .carte-shine { opacity: .45; }
body.no-fx .carte-holo { opacity: .25; }
@media (prefers-reduced-motion: reduce) {
  .carte, .carte *, .boo-overlay, .boo-overlay * { animation: none !important; transition: none !important; }
  .carte-shine::before { background-position: 50% 0; }
}

/* ---------------- Ouverture d'un booster ---------------- */
.boo-overlay {
  position: fixed; inset: 0; z-index: 99990; display: grid; place-items: center; overflow-y: auto; padding: 16px;
  background: radial-gradient(circle at 50% 35%, #4b2f9e 0%, #1c1250 62%, #0d0830 100%); color: #fff; text-align: center;
}
body.boo-open { overflow: hidden; }
.boo-close { position: fixed; top: 12px; right: 12px; z-index: 3; width: 52px; height: 52px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, .18); color: #fff; font-size: 1.4rem; cursor: pointer; }
.boo-stage { width: 100%; max-width: 560px; display: flex; flex-direction: column; align-items: center; gap: 14px; position: relative; }
.boo-pack { position: relative; width: min(58vw, 230px); aspect-ratio: 3 / 4; filter: drop-shadow(0 14px 22px rgba(0, 0, 0, .45)); }
.boo-body, .boo-flap { position: absolute; left: 0; right: 0; background: linear-gradient(160deg, #ffd23f 0%, #ff7b00 45%, #e11d74 100%); border: 4px solid rgba(255, 255, 255, .75); }
.boo-body { top: 12%; bottom: 0; border-radius: 0 0 16px 16px; border-top: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; }
.boo-flap { top: 0; height: 14%; border-radius: 16px 16px 0 0; transform-origin: 0 100%; background: linear-gradient(160deg, #ffe27a, #ff9b2f); clip-path: polygon(0 0, 8% 100%, 16% 0, 24% 100%, 32% 0, 40% 100%, 48% 0, 56% 100%, 64% 0, 72% 100%, 80% 0, 88% 100%, 96% 0, 100% 100%, 0 100%); }
.boo-logo { font-size: 4.6rem; line-height: 1; text-shadow: 0 3px 0 rgba(0, 0, 0, .25); }
.boo-body b { font-size: 1.6rem; letter-spacing: 2px; text-shadow: 0 2px 0 rgba(0, 0, 0, .25); }
.boo-body small { font-size: 1rem; opacity: .95; }
.boo-pack.shake { animation: booShake .7s ease-in-out infinite; }
@keyframes booShake { 0%, 100% { transform: rotate(0); } 15% { transform: rotate(-6deg) translateX(-4px); } 30% { transform: rotate(6deg) translateX(4px); } 45% { transform: rotate(-5deg); } 60% { transform: rotate(5deg); } 75% { transform: rotate(-2deg); } }
.boo-pack.tear .boo-flap { animation: booTear .8s ease-in forwards; }
.boo-pack.tear .boo-body { animation: booFade .9s ease-in .35s forwards; }
@keyframes booTear { 30% { transform: rotate(-14deg); } 100% { transform: translate(-70vw, -40vh) rotate(-80deg); opacity: 0; } }
@keyframes booFade { to { opacity: 0; transform: scale(.92) translateY(18px); } }
.boo-burst { position: absolute; top: 18%; left: 50%; width: 10px; height: 10px; border-radius: 50%; transform: translate(-50%, -50%); pointer-events: none; opacity: 0; }
.boo-burst.on { animation: booBurst 1s ease-out forwards; background: radial-gradient(circle, #fff 0%, rgba(255, 244, 190, .9) 35%, transparent 70%); }
@keyframes booBurst { 0% { opacity: 0; transform: translate(-50%, -50%) scale(1); } 30% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -50%) scale(90); } }
.boo-msg { margin: 0; min-height: 1.4em; opacity: .9; }
.boo-deck { display: flex; flex-direction: column; align-items: center; gap: 12px; width: 100%; }
.boo-count { margin: 0; font-weight: 600; font-size: 1.1rem; }
.boo-hint { margin: 0; opacity: .85; font-size: .95rem; }
.boo-backs { position: relative; width: 0; height: 0; }
.boo-backs i { position: absolute; width: min(72vw, 330px); aspect-ratio: 3 / 4; border-radius: 7% / 5.25%; transform: translate(-50%, 0); background: linear-gradient(135deg, #3b2a85, #6a4cd6); border: 4px solid rgba(255, 255, 255, .35); opacity: .55; }
.boo-backs i:nth-child(1) { top: 10px; transform: translate(-50%, 0) rotate(-4deg); }
.boo-backs i:nth-child(2) { top: 5px; transform: translate(-50%, 0) rotate(3deg); }
.boo-card { position: relative; z-index: 1; cursor: grab; }
.boo-card.flip-in { animation: booFlip .5s ease-out; }
@keyframes booFlip { from { transform: perspective(700px) rotateY(90deg) scale(.85); opacity: 0; } to { transform: perspective(700px) rotateY(0) scale(1); opacity: 1; } }
.boo-sparkles { position: absolute; inset: -8%; pointer-events: none; z-index: 7; background:
  radial-gradient(circle at 12% 18%, #fff 0 2px, transparent 3px), radial-gradient(circle at 88% 12%, #fff 0 3px, transparent 4px), radial-gradient(circle at 92% 70%, #fff 0 2px, transparent 3px),
  radial-gradient(circle at 8% 78%, #ffe27a 0 3px, transparent 4px), radial-gradient(circle at 50% 4%, #ffe27a 0 2px, transparent 3px); animation: booTwinkle 1.2s ease-in-out infinite; }
@keyframes booTwinkle { 50% { opacity: .25; transform: scale(1.04); } }
.boo-summary h2 { margin: 0 0 12px; }
.boo-grid { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; }
.boo-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin-top: 18px; }

/* ---------------- Page « Mes cartes » (enfant) ---------------- */
.cards-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0 12px; }
.cards-panel { background: #fff; border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow); margin-bottom: 14px; }
.cards-panel h2 { margin: 0 0 8px; font-size: 1.3rem; }
.boo-pills { display: flex; gap: 8px; margin: 8px 0; }
.boo-pill { width: 38px; height: 52px; border-radius: 8px; border: 3px solid var(--line); background: #f3effd; }
.boo-pill.on { background: linear-gradient(160deg, #ffd23f, #ff7b00 60%, #e11d74); border-color: #fff; box-shadow: 0 0 0 2px #ff9b2f; }
.cards-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 8px; }
.cards-note { font-size: .92rem; color: var(--muted); margin: 6px 0 0; }
.cards-progress { margin: 0 0 10px; }
.cards-group h3 { margin: 16px 0 8px; font-size: 1.1rem; }
.cards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); gap: 14px 12px; justify-items: center; }
.cards-grid .carte { cursor: pointer; }
.cards-more { display: block; margin: 14px auto 0; }
.card-zoom { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; }
.card-zoom p { margin: 0; }
.card-pick { display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-start; }
.card-pick .carte { cursor: pointer; outline: 4px solid transparent; outline-offset: 3px; border-radius: 7% / 5.25%; }
.card-pick .carte.picked { outline-color: var(--primary); }
.exch-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; padding: 10px 0; border-top: 1px solid var(--line); }
.exch-row:first-of-type { border-top: 0; }
.exch-cards { display: flex; align-items: center; gap: 8px; }
.exch-arrow { font-size: 1.6rem; }
.exch-main { flex: 1 1 180px; min-width: 0; }
.hw-count.cards-count { background: #e11d74; }

/* ---------------- Espace parent : bibliothèque, créateur, import ---------------- */
.pc-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.pc-lib { display: grid; grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); gap: 16px 12px; justify-items: center; }
.pc-item { position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; }
.pc-item .carte { cursor: pointer; }
.pc-draft { background: #ffedd5; color: #9a3412; border-radius: 99px; padding: 2px 10px; font-size: .78rem; font-weight: 700; }
.pc-create { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 18px; align-items: start; }
.pc-preview { position: sticky; top: 12px; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.pc-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 10px; }
.pc-crop { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.pc-crop canvas { width: min(260px, 100%); aspect-ratio: 3 / 4; border-radius: 12px; border: 3px solid var(--line); touch-action: none; cursor: grab; background: #eee; }
.pc-crop input[type=range] { width: min(260px, 100%); }
.pc-rights { background: #fff7e6; border: 2px solid #ffd58a; border-radius: 12px; padding: 10px 14px; font-size: .92rem; }
.pc-report dl { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 8px; margin: 10px 0; }
.pc-report dl div { background: #f3effd; border-radius: 12px; padding: 8px 12px; }
.pc-report dt { font-size: .8rem; color: var(--muted); }
.pc-report dd { margin: 0; font-size: 1.4rem; font-weight: 700; }
.pc-errors { max-height: 320px; overflow: auto; }
.fiche-cards .pc-give { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; }
.fiche-cards .pc-give input[type=text] { flex: 1 1 220px; }

@media (max-width: 700px) {
  .pc-create { grid-template-columns: minmax(0, 1fr); }
  .pc-preview { position: static; order: -1; }
  .cards-grid, .pc-lib { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); }
  .carte.s-sm { --cw: 104px; }
}
