/* =====================================================================
   Style du site : « interface de jeu », palette cyan arcade.
   1re partie : le design du site (barre du haut, pages, jauges...).
   2e partie (« .classique ») : le style d'origine des cartes, du paquet,
   de l'ouverture des boosters et de la Collection, gardé tel quel.
   ===================================================================== */

/* ---------- Polices (hébergées sur ce serveur) ---------- */
@font-face {
  font-family: "Inter"; src: url(/polices/inter.woff2) format("woff2");
  font-weight: 100 900; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "JetBrains Mono"; src: url(/polices/jetbrains-mono.woff2) format("woff2");
  font-weight: 100 800; font-style: normal; font-display: swap;
}

/* ---------- Couleurs et mesures (cyan arcade) ---------- */
:root {
  --fond: #0a0e14;          /* bleu nuit presque noir */
  --surface: #0f151e;
  --surface-2: #16202d;
  --bord: #223044;
  --texte: #dfe7ef;
  --discret: #8a9bb0;       /* contraste 6,8:1 sur le fond */
  --accent: #4fd6ec;        /* la seule couleur d'accent : cyan */
  --accent-texte: #06222a;
  --danger: #ff7a6b;
  --police: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace;
  --barre: 56px;
  /* couleur de chaque rareté, de Commun (r0) à Mythique (r5) */
  --r0: #9aa0a6;
  --r1: #4cc16d;
  --r2: #3d8bfd;
  --r3: #a35cf0;
  --r4: #ff9f1c;
  --r5: #ff3d7f;
  color-scheme: dark;
}
/* Couleur du halo de fond : dorée, puis celle de la rareté pendant l'ouverture */
@property --halo { syntax: "<color>"; inherits: true; initial-value: #ffcc4d; }
@property --tour { syntax: "<angle>"; inherits: false; initial-value: 0deg; }

/* ---------- Base ---------- */
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--fond); color: var(--texte); overflow-x: hidden; }
body {
  font: 15px/1.5 var(--police);
  min-height: 100vh; display: flex; flex-direction: column;
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
}
/* Couleur de rareté utilisable sur n'importe quel élément */
.r0 { --c: var(--r0); } .r1 { --c: var(--r1); } .r2 { --c: var(--r2); }
.r3 { --c: var(--r3); } .r4 { --c: var(--r4); } .r5 { --c: var(--r5); }

/* Focus visible au clavier, partout */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
main:focus { outline: none; }
.aller-contenu {
  position: absolute; left: 16px; top: -48px; z-index: 50; padding: 8px 12px;
  background: var(--accent); color: var(--accent-texte); text-decoration: none; font: 500 13px var(--mono);
}
.aller-contenu:focus { top: 8px; }
.visuellement-cache {
  position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}
.icone {
  width: 18px; height: 18px; flex: none;
  fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}
.discret { color: var(--discret); }
.manette {
  -webkit-mask: url(/manette.svg) center / contain no-repeat;
  mask: url(/manette.svg) center / contain no-repeat;
}

/* ---------- Barre du haut (gardée telle quelle, aux nouvelles couleurs) ---------- */
.barre {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 24px;
  height: calc(var(--barre) + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) max(16px, env(safe-area-inset-right)) 0 max(16px, env(safe-area-inset-left));
  background: var(--fond); border-bottom: 1px solid var(--bord);
}
.marque {
  display: flex; align-items: center; gap: 10px; flex: none;
  color: var(--texte); text-decoration: none; font-weight: 600; font-size: 15px; letter-spacing: -.01em;
}
.marque .manette { width: 26px; aspect-ratio: 16 / 9; background: var(--accent); }
.menu {
  display: flex; align-self: stretch; gap: 4px; flex: 1; min-width: 0;
  overflow-x: auto; scrollbar-width: none;
}
.menu::-webkit-scrollbar { display: none; }
.menu a {
  display: inline-flex; align-items: center; gap: 8px; flex: none; padding: 0 12px;
  color: var(--discret); text-decoration: none; font-weight: 500; font-size: 14px; white-space: nowrap;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.menu a:hover { color: var(--texte); }
.menu a[aria-current="page"] { color: var(--texte); border-bottom-color: var(--accent); }
.menu a:focus-visible { outline-offset: -4px; }

/* Compte : rond avec la photo, et son menu */
.compte { position: relative; margin-left: auto; display: flex; align-items: center; flex: none; }
.avatar {
  width: 32px; height: 32px; padding: 0; flex: none; overflow: hidden; cursor: pointer;
  display: grid; place-items: center; border-radius: 50%;
  border: 1px solid var(--bord); background: var(--surface-2); color: var(--texte);
  font: 600 14px/1 var(--mono);
}
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar:hover { border-color: var(--accent); }
.avatar-grand { width: 48px; height: 48px; font-size: 18px; cursor: default; }
.avatar-grand:hover { border-color: var(--bord); }
.deroulant {
  position: absolute; top: calc(100% + 10px); right: 0; z-index: 30; min-width: 260px; padding: 4px;
  background: var(--fond); border: 1px solid var(--bord); border-top: 2px solid var(--accent);
  font-family: var(--mono);
}
.deroulant-tete {
  display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; margin-bottom: 4px;
  border-bottom: 1px solid var(--bord);
}
.deroulant-tete b { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.deroulant-tete span { font-size: 11px; color: var(--discret); text-transform: uppercase; letter-spacing: .1em; }
.deroulant [role="menuitem"] {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 12px;
  border: 0; background: none; color: var(--texte);
  font: 400 13px/1.3 var(--mono); text-align: left; text-decoration: none; cursor: pointer;
}
.deroulant [role="menuitem"] .icone { color: var(--discret); width: 16px; height: 16px; }
.deroulant [role="menuitem"]:hover, .deroulant [role="menuitem"]:focus-visible {
  background: var(--surface-2); box-shadow: inset 2px 0 var(--accent);
}
.deroulant [role="menuitem"]:focus-visible { outline: none; }

/* ---------- Mise en page ---------- */
main { flex: 1; width: 100%; max-width: 1032px; margin: 0 auto; padding: 32px 16px 48px; }
.pied {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 24px;
  width: 100%; max-width: 1032px; margin: 0 auto; padding: 20px 16px calc(20px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--bord); color: var(--discret); font-size: 13px;
}
.pied a { color: var(--discret); }
.pied a:hover { color: var(--texte); }

/* ---------- Langage « interface de jeu » : police mono, angles droits ---------- */
.accueil, .page, #attente, #recap { font-family: var(--mono); }
.sur-titre, .accueil-sur {
  margin: 0 0 6px; font: 500 12px/1.4 var(--mono); color: var(--accent);
  text-transform: uppercase; letter-spacing: .14em;
}
.titre-page { font: 600 26px/1.15 var(--mono); letter-spacing: -.02em; margin: 0; overflow-wrap: anywhere; }
.page { max-width: 680px; font-size: 14px; }
.page-tete { margin-bottom: 28px; }
.page-intro { margin: 8px 0 0; color: var(--discret); }

/* Sections : un titre en majuscules et un trait, pas de boîte */
.panneau {
  display: flex; flex-direction: column; align-items: flex-start; gap: 12px;
  padding: 20px 0 28px; border-top: 1px solid var(--bord);
}
.panneau h2 {
  margin: 0 0 4px; font: 500 12px/1.4 var(--mono); color: var(--discret);
  text-transform: uppercase; letter-spacing: .14em;
}
.panneau p { margin: 0; }
.panneau-danger h2 { color: var(--danger); }
.titre-section { font: 600 16px/1.3 var(--mono); text-transform: uppercase; letter-spacing: .06em; margin: 0; }

/* Bloc important : trait d'accent à gauche */
.profil {
  display: flex; align-items: center; gap: 14px;
  padding: 4px 0 4px 14px; border-left: 2px solid var(--accent);
}
.profil b { display: block; font-weight: 600; font-size: 15px; }
.profil .discret { font-size: 12px; }

/* ---------- Boutons et champs ---------- */
.bouton {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  height: 40px; padding: 0 18px; border: 1px solid transparent; border-radius: 0;
  font: 500 13px/1 var(--mono); text-transform: uppercase; letter-spacing: .08em;
  text-decoration: none; white-space: nowrap; cursor: pointer;
}
.bouton .icone { width: 16px; height: 16px; }
.bouton-principal { background: var(--accent); color: var(--accent-texte); }
.bouton-principal:hover { background: #7fe3f3; }
.bouton-secondaire { background: transparent; border-color: var(--bord); color: var(--texte); }
.bouton-secondaire:hover { border-color: var(--accent); }
.bouton-danger { background: transparent; border-color: var(--danger); color: var(--danger); }
.bouton-danger:hover { background: color-mix(in srgb, var(--danger) 12%, transparent); }
.bouton-danger-plein { background: var(--danger); color: #2a0703; }
.bouton:disabled { background: transparent; border-color: var(--bord); color: var(--discret); cursor: not-allowed; }
.bouton-grand { height: 48px; padding: 0 26px; font-size: 14px; font-weight: 600; }
.bouton small { font: 400 12px/1 var(--mono); text-transform: none; letter-spacing: 0; padding-left: 12px; border-left: 1px solid rgba(0, 0, 0, .25); }
.bouton:disabled small { border-color: var(--bord); }
/* Le bouton de connexion de la barre du haut garde la police du menu */
.barre .bouton { font-family: var(--police); text-transform: none; letter-spacing: 0; height: 36px; }

.champ {
  width: 100%; height: 40px; padding: 0 12px; border: 1px solid var(--bord); border-radius: 0;
  background: var(--fond); color: var(--texte); font: 400 14px var(--mono);
}
.champ:focus { border-color: var(--accent); outline: none; }
.etiquette { font-size: 13px; color: var(--discret); }
.etiquette b { color: var(--texte); font-weight: 600; }
.confirmation { display: flex; flex-direction: column; gap: 8px; width: 100%; max-width: 420px; }
.rangee { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }

/* Case à cocher façon [ ] / [x] */
.option { display: flex; align-items: flex-start; gap: 12px; cursor: pointer; }
.option input {
  appearance: none; -webkit-appearance: none; flex: none; margin: 1px 0 0;
  width: 18px; height: 18px; border: 1px solid var(--discret); background: transparent;
  display: grid; place-items: center; cursor: pointer;
}
.option input:checked { border-color: var(--accent); }
.option input:checked::after { content: ""; width: 10px; height: 10px; background: var(--accent); }
.option input:disabled { opacity: .6; cursor: not-allowed; }
.option b { display: block; font-weight: 500; }
.option small { display: block; color: var(--discret); font-size: 12px; margin-top: 2px; }

.message { margin: 0; color: var(--r1); font: 13px var(--mono); }
.message-erreur { color: var(--danger); }

/* Tableau des probabilités */
.tableau-defile { width: 100%; overflow-x: auto; }
.tableau { width: 100%; border-collapse: collapse; font: 13px var(--mono); }
.tableau th {
  text-align: left; font-weight: 500; color: var(--discret); font-size: 11px; text-transform: uppercase;
  letter-spacing: .1em; padding: 8px 14px 8px 0; border-bottom: 1px solid var(--bord);
}
.tableau td { padding: 10px 14px 10px 0; border-bottom: 1px solid var(--bord); white-space: nowrap; }
.tableau tr:last-child td { border-bottom: 0; }
.pastille { display: inline-block; width: 8px; height: 8px; background: var(--c); margin-right: 10px; vertical-align: 1px; }
.liste { margin: 0; padding: 0; list-style: none; color: var(--discret); display: flex; flex-direction: column; gap: 8px; }
.liste li { padding-left: 16px; position: relative; }
.liste li::before { content: ">"; position: absolute; left: 0; color: var(--accent); }

/* ---------- Accueil (non connecté) ---------- */
.accueil { max-width: 620px; padding-top: 8vh; display: flex; flex-direction: column; align-items: flex-start; gap: 16px; }
.accueil-titre { margin: 0; font: 600 clamp(26px, 5.5vw, 38px)/1.15 var(--mono); letter-spacing: -.03em; }
.accueil-texte { margin: 0 0 8px; color: var(--discret); font-size: 14px; max-width: 54ch; }
.accueil-note { margin: 0; color: var(--discret); font-size: 12px; }

/* ---------- Écran booster : jauges et commandes autour du paquet ---------- */
.jauges { display: grid; gap: 14px; width: min(100%, 420px); margin: 0 auto 4px; font-family: var(--mono); }
.jauge-titre {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 8px; margin: 0 0 6px;
  font-size: 11px; color: var(--discret); text-transform: uppercase; letter-spacing: .1em;
}
.jauge-titre b { color: var(--texte); font-weight: 600; font-size: 13px; letter-spacing: .02em; }
.jauge-titre b.mythique { color: var(--r5); }
#st-stock-txt { margin-left: auto; text-transform: none; letter-spacing: 0; }
/* Stock : une case par booster, comme des vies */
.stock-cases { display: grid; grid-template-columns: repeat(10, 1fr); gap: 3px; }
.stock-cases span { height: 12px; background: var(--bord); }
.stock-cases span.pleine { background: var(--accent); }
/* Barres : Mythique garantie (rose, la couleur des Mythiques) et album */
.barre-jauge { height: 6px; background: var(--bord); }
.barre-jauge span { display: block; height: 100%; width: 0; background: var(--discret); transition: width .4s; }
.barre-mythique span { background: var(--r5); }

#attente { display: flex; flex-direction: column; align-items: center; gap: 16px; margin-top: 4vh; }
.aide { margin: 0; color: var(--discret); font-size: 12px; text-align: center; }
.choix-nombre { display: flex; gap: 0; border: 1px solid var(--bord); }
.choix-nombre button {
  height: 34px; min-width: 52px; padding: 0 12px; border: 0; border-radius: 0; cursor: pointer;
  background: transparent; color: var(--discret); font: 500 13px var(--mono);
}
.choix-nombre button + button { border-left: 1px solid var(--bord); }
.choix-nombre button:hover:not(:disabled) { color: var(--texte); }
.choix-nombre button.actif { background: var(--surface-2); color: var(--accent); box-shadow: inset 0 -2px var(--accent); }
.choix-nombre button:disabled { opacity: .35; cursor: not-allowed; }
.panneau-test {
  display: flex; flex-direction: column; gap: 6px; width: min(100%, 320px);
  font: 500 11px var(--mono); color: var(--r4); text-transform: uppercase; letter-spacing: .1em;
}
.panneau-test .champ { text-transform: none; letter-spacing: 0; }
#recap { margin-top: 3vh; display: flex; flex-direction: column; align-items: center; gap: 20px; }
#recap .grille { position: relative; max-width: 800px; }

@media (max-width: 640px) {
  .barre { gap: 12px; }
  .marque-nom { display: none; }
  .menu a { padding: 0 10px; }
  main { padding-top: 24px; }
  .titre-page { font-size: 22px; }
}

/* ---------- Ambiance du booster : halo + particules (seulement sur l'écran Boosters) ---------- */
body:not([data-ecran="booster"]) #fond { display: none; }
#fond {
  position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none;
  background: radial-gradient(ellipse 65% 50% at 50% 42%, color-mix(in srgb, var(--halo) 28%, transparent), transparent 72%), var(--fond);
  transition: --halo .8s;
}
.particule {
  position: absolute; bottom: -10px; left: var(--x); width: 3px; height: 3px; border-radius: 50%;
  background: var(--halo); box-shadow: 0 0 6px var(--halo); opacity: 0;
  animation: monte var(--duree) linear var(--delai) infinite;
}
@keyframes monte {
  10% { opacity: .7; }
  85% { opacity: .4; }
  to { transform: translateY(-105vh); opacity: 0; }
}

/* Moins d'animations : demandé par l'appareil, ou choisi dans les Paramètres */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition-duration: .01s !important; }
}
.moins-anim *, .moins-anim *::before, .moins-anim *::after { animation: none !important; transition-duration: .01s !important; }
.moins-anim .particule { display: none; }


/* =====================================================================
   STYLE D'ORIGINE : cartes, paquet, ouverture des boosters, Collection.
   Tout ce qui est dans un bloc « .classique » garde ses anciennes
   couleurs, sa police et ses réglages. Ne pas modifier sans comparer.
   ===================================================================== */
.classique {
  --fond: #0b0a10;
  --panneau: #15121d;
  --bord: #2a2438;
  --texte: #f1eefa;
  --discret: #a49cbc;
  --sombre: #5d566f;
  --accent: #ffcc4d;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font: 16px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--texte);
  -webkit-font-smoothing: auto;
}
/* Anciens réglages des éléments, limités aux blocs classiques (:where = sans priorité en plus) */
:where(.classique) h2 { font-size: 1.2rem; margin: 0 0 12px; text-align: center; font-weight: 900; }
:where(.classique) button {
  font: inherit; font-weight: 700; border: 0; border-radius: 12px;
  padding: 14px 20px; background: var(--accent); color: #1d1600; cursor: pointer;
}
:where(.classique) button:disabled { background: #2a2438; color: var(--discret); cursor: default; }
:where(.classique) button.secondaire { background: transparent; color: var(--texte); border: 1px solid #3a3350; }
:where(.classique) button.petit { padding: 9px 16px; font-size: .9rem; }
:where(.classique) label { display: flex; flex-direction: column; gap: 6px; color: var(--discret); font-size: .9rem; }
:where(.classique) input, :where(.classique) select {
  font: inherit; padding: 12px; border-radius: 10px; border: 1px solid var(--bord);
  background: var(--panneau); color: var(--texte);
}

/* ---------- Écran booster : le paquet ---------- */
.zone-paquet { animation: flotte 3.2s ease-in-out infinite; }
.ombre {
  width: 160px; height: 18px; margin-top: -8px; border-radius: 50%;
  background: radial-gradient(ellipse, rgba(0, 0, 0, .7), transparent 70%);
  animation: ombre 3.2s ease-in-out infinite;
}
@keyframes flotte { 50% { transform: translateY(-10px); } }
@keyframes ombre { 50% { transform: scale(.82); opacity: .6; } }

.paquet {
  --or: linear-gradient(125deg, #7a5a0c 0%, #f3cf5f 18%, #b98d1d 36%, #fff0a8 50%, #b5891a 64%, #f0c84a 82%, #7a5a0c 100%);
  position: relative; width: min(60vw, 230px); aspect-ratio: 5 / 7.2; cursor: pointer;
  container-type: inline-size;
}
/* Haut et corps partagent le même dégradé doré (aligné grâce aux tailles de fond) */
.paquet .haut, .paquet .corps {
  position: absolute; left: 0; right: 0;
  background: radial-gradient(circle, rgba(0, 0, 0, .16) 1px, transparent 1.6px) 0 0 / 7px 7px, var(--or);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .35);
}
.paquet .haut {
  top: 0; height: 14%; border-radius: 12px 12px 0 0; touch-action: none;
  background-size: 7px 7px, 100% 714%; background-position: 0 0, top;
}
.paquet .corps {
  top: 14%; bottom: 0; border-radius: 0 0 12px 12px; padding-bottom: 8%;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3cqw;
  background-size: 7px 7px, 100% 116.3%; background-position: 0 0, bottom;
}
.paquet .dents {
  position: absolute; left: 0; right: 0; height: 6cqw;
  background: repeating-linear-gradient(90deg, rgba(60, 40, 0, .45) 0 1.5cqw, rgba(255, 255, 255, .25) 1.5cqw 3cqw);
}
.paquet .haut .dents { top: 0; border-radius: 12px 12px 0 0; }
.paquet .corps .dents { bottom: 0; border-radius: 0 0 12px 12px; }
/* Ligne de déchirure en pointillés, qui se remplit quand on glisse le doigt */
.dechirure { position: absolute; left: 6%; right: 6%; bottom: -1px; border-top: 2px dashed rgba(255, 255, 255, .75); }
.dechirure::after {
  content: ""; position: absolute; right: -7px; top: -8px; width: 12px; height: 12px; border-radius: 50%;
  background: #fff; box-shadow: 0 0 8px #fff;
}
#progres-dechirure {
  position: absolute; left: 0; top: -2px; height: 2px; width: calc(var(--p, 0) * 100%);
  background: #fff; box-shadow: 0 0 10px #fff, 0 0 4px var(--accent);
}
.paquet .medaillon {
  width: 46cqw; aspect-ratio: 1; border-radius: 50%; display: grid; place-items: center;
  background: radial-gradient(circle at 40% 35%, #3a3346, #15121c 70%);
  border: 2.5cqw solid #f5d36a;
  box-shadow: 0 0 0 1cqw #6b4f0c, 0 1.5cqw 4cqw rgba(0, 0, 0, .45), inset 0 0 4cqw rgba(0, 0, 0, .6);
}
.paquet .medaillon .manette { width: 64%; aspect-ratio: 16 / 9; background: linear-gradient(180deg, #fff2b0, #f0c23a 55%, #b8870f); }
.paquet .titre { font-weight: 900; font-size: 11cqw; letter-spacing: -.03em; color: #2b2005; text-shadow: 0 1px 0 rgba(255, 255, 255, .5); }
.paquet .sous { font-size: 5cqw; color: #4a3a10; margin-top: -2.5cqw; }
.paquet .nb { font: 700 5cqw var(--mono); background: #1a1622; color: #f5d36a; padding: 1.2cqw 4cqw; border-radius: 99px; }
.paquet.vide { filter: grayscale(.7) brightness(.55); cursor: default; }
/* Plusieurs boosters : d'autres paquets dépassent derrière */
.paquet.plusieurs::before, .paquet.plusieurs::after {
  content: ""; position: absolute; inset: 0; z-index: -1; border-radius: 12px; opacity: .75;
  background: linear-gradient(125deg, #5a420a, #c9a43f 45%, #7a5a0c); transition: opacity .3s;
}
.paquet.plusieurs::before { transform: translate(12px, -8px) rotate(5deg); }
.paquet.plusieurs::after { transform: translate(-12px, -6px) rotate(-5deg); }
.paquet.dechire::before, .paquet.dechire::after { opacity: 0; }
.paquet.pret { animation: brille 2.4s ease-in-out infinite; }
.paquet.secoue { animation: secoue .45s linear; }
.paquet.dechire .haut { animation: arrache .6s ease-out forwards; }
.paquet.dechire .corps { animation: tombe .55s .15s ease-in forwards; }
@keyframes brille {
  0%, 100% { filter: drop-shadow(0 0 8px color-mix(in srgb, var(--accent) 35%, transparent)); }
  50% { filter: drop-shadow(0 0 28px color-mix(in srgb, var(--accent) 75%, transparent)); }
}
@keyframes secoue {
  0%, 100% { transform: none; }
  20% { transform: translateX(-5px) rotate(-3deg); }
  40% { transform: translateX(5px) rotate(3deg); }
  60% { transform: translateX(-4px) rotate(-2deg); }
  80% { transform: translateX(4px) rotate(2deg); }
}
@keyframes arrache { to { transform: translate(70px, -140px) rotate(40deg); opacity: 0; } }
@keyframes tombe { to { transform: translateY(50px) scale(.9); opacity: 0; } }

/* ---------- Écran booster : ouverture ---------- */
#ouverture { display: flex; flex-direction: column; align-items: center; gap: 14px; margin-top: 2vh; }
.scene-carte { position: relative; width: min(74vw, 290px); aspect-ratio: 5 / 7; }
#pile { position: absolute; inset: 0; }
.pile-carte {
  position: absolute; inset: 0; border-radius: 14px; border: 2px solid #4a3d1e;
  background: linear-gradient(160deg, #221c2c, #120f19);
}
.pile-carte:nth-child(1) { transform: translate(5px, -5px) rotate(2deg); }
.pile-carte:nth-child(2) { transform: translate(10px, -10px) rotate(4deg); }
.pile-carte:nth-child(3) { transform: translate(15px, -14px) rotate(6deg); }
.pile-carte:nth-child(4) { transform: translate(20px, -18px) rotate(8deg); }
.emplacement {
  position: relative; z-index: 1; width: 100%; height: 100%; perspective: 1000px; cursor: pointer;
  touch-action: none;   /* glisser le doigt incline la carte au lieu de faire défiler */
  transform: perspective(900px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg));
  transition: transform .15s;
}
#legende { text-align: center; min-height: 86px; max-width: 100%; }
#legende.cachee { visibility: hidden; }
#leg-rarete { font-weight: 800; font-size: .95rem; color: var(--c); }
#leg-nom { font-weight: 900; font-size: 1.7rem; line-height: 1.1; letter-spacing: -.02em; }
#leg-info { color: var(--discret); font-size: .9rem; margin-top: 4px; }
#leg-info b { color: var(--accent); }
.cases { display: flex; gap: 6px; }
.case { width: 22px; height: 30px; border-radius: 5px; background: #1d1828; border: 1px solid #2e2740; transition: .3s; }
.case.courante { border-color: var(--texte); }
.cases.multi { flex-wrap: wrap; justify-content: center; max-width: 320px; gap: 4px; }
.cases.multi .case { width: 12px; height: 16px; border-radius: 3px; }
.case.remplie { background: var(--c); border-color: var(--c); box-shadow: 0 0 10px var(--c); }
.actions { display: flex; align-items: center; gap: 12px; justify-content: center; flex-wrap: wrap; color: var(--discret); font-size: .9rem; }
.raccourcis { font: .75rem var(--mono); color: var(--sombre); margin: 0; }

/* Entrée de la carte : elle sort du paquet avec un rebond */
.entree { position: relative; z-index: 1; width: 100%; height: 100%; animation: entree .5s cubic-bezier(.2, 1.5, .4, 1); }
.entree.charge { animation: charge .7s ease-in; }
@keyframes entree { from { transform: translateY(70%) scale(.5); opacity: 0; } }
@keyframes charge {
  0% { transform: none; }
  20% { transform: translateX(-2px) rotate(-1deg); }
  40% { transform: translateX(3px) rotate(1.5deg) scale(1.02); }
  60% { transform: translateX(-4px) rotate(-2deg) scale(1.04); }
  80% { transform: translateX(5px) rotate(2.5deg) scale(1.06); }
  100% { transform: scale(1.08); }
}

/* Retournement d'une carte */
.retournable { position: relative; width: 100%; height: 100%; transition: transform .6s; transform-style: preserve-3d; }
.retournable.retournee { transform: rotateY(180deg); }
.retournable > * { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.retournable > .carte { position: absolute; inset: 0; transform: rotateY(180deg); }

/* ---------- Dos de carte ---------- */
.dos {
  --c: #c9971f;
  container-type: inline-size; overflow: hidden;
  border-radius: 14px; border: 2px solid #5a4a22;
  background:
    radial-gradient(circle, rgba(255, 204, 77, .12) 1px, transparent 1.5px) 0 0 / 10px 10px,
    radial-gradient(circle at 50% 45%, #2a2236, #120f19 70%);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.dos::before {
  content: ""; position: absolute; inset: 5cqw; border-radius: 8px; pointer-events: none;
  border: 1px solid color-mix(in srgb, var(--c) 50%, transparent);
}
.dos .coin {
  position: absolute; width: 5cqw; height: 5cqw; transform: rotate(45deg);
  background: linear-gradient(135deg, #fff2b0, var(--c));
}
.coin.hg { top: 2.5cqw; left: 2.5cqw; } .coin.hd { top: 2.5cqw; right: 2.5cqw; }
.coin.bg { bottom: 2.5cqw; left: 2.5cqw; } .coin.bd { bottom: 2.5cqw; right: 2.5cqw; }
.dos .medaillon {
  width: 42cqw; aspect-ratio: 1; border-radius: 50%; display: grid; place-items: center;
  background: radial-gradient(circle at 35% 30%, #fff2b0, #f0c23a 40%, #a87a12 80%);
  border: 1.5cqw solid #1a1420;
  box-shadow: 0 0 0 1cqw var(--c), 0 0 0 3cqw color-mix(in srgb, var(--c) 25%, transparent), 0 0 10cqw color-mix(in srgb, var(--c) 30%, transparent);
}
.dos .medaillon .manette { width: 62%; aspect-ratio: 16 / 9; background: #3a2a05; }
.dos .marque { margin-top: 9cqw; font-weight: 900; letter-spacing: .35em; padding-left: .35em; font-size: 6.5cqw; color: #f0c94a; }
/* Suspense : à partir de Rare, le dos laisse filtrer la couleur de la rareté */
.dos.n2 { --c: var(--r2); } .dos.n3 { --c: var(--r3); } .dos.n4 { --c: var(--r4); } .dos.n5 { --c: var(--r5); }
.dos:is(.n2, .n3, .n4, .n5) { border-color: var(--c); animation: lueur 1.4s ease-in-out infinite; }
.dos.n4 { animation-duration: 1s; }
.dos.n5 { animation: lueur .7s ease-in-out infinite, tremble .25s linear infinite; }
@keyframes lueur {
  0%, 100% { box-shadow: 0 0 8px var(--c); }
  50% { box-shadow: 0 0 34px 6px var(--c); }
}
@keyframes tremble {
  0%, 100% { translate: 0 0; }
  25% { translate: -2px 1px; }
  75% { translate: 2px -1px; }
}

/* ---------- Face d'une carte ---------- */
.carte {
  --c: var(--r0);
  position: relative; container-type: inline-size; overflow: hidden;
  display: flex; flex-direction: column; gap: 4px; padding: 12px;
  border-radius: 16px; border: 3px solid var(--c);
  background: linear-gradient(160deg, color-mix(in srgb, var(--c) 28%, #241f33), #241f33 60%);
}
.carte.r0 { --c: var(--r0); } .carte.r1 { --c: var(--r1); } .carte.r2 { --c: var(--r2); }
.carte.r3 { --c: var(--r3); } .carte.r4 { --c: var(--r4); } .carte.r5 { --c: var(--r5); }
.carte .rarete { font-size: 7cqw; font-weight: 700; color: var(--c); text-transform: uppercase; letter-spacing: .05em; }
.carte .nom { font-size: 11cqw; font-weight: 800; line-height: 1.1; margin: 4px 0 6px; overflow-wrap: anywhere; }
.carte .info { font-size: 6.5cqw; color: var(--discret); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.carte .info b { color: var(--texte); font-weight: 600; }
.carte .stats { display: flex; justify-content: space-between; margin-top: auto; padding-top: 6px; font-size: 9cqw; font-weight: 800; }
.carte .stats span { font-size: 5.5cqw; font-weight: 600; color: var(--discret); display: block; }
.carte .badge {
  position: absolute; top: 8px; right: 8px; font-size: 5.5cqw; font-weight: 700;
  background: var(--accent); color: #1d1600; border-radius: 99px; padding: 1px 8px;
}
/* Bordure arc-en-ciel qui tourne pour les Mythiques, lueur pour les Légendaires */
.carte.r4:not(.inconnue) { box-shadow: 0 0 16px color-mix(in srgb, var(--r4) 45%, transparent); }
.carte.r5:not(.inconnue) {
  border-color: transparent;
  background:
    linear-gradient(160deg, color-mix(in srgb, var(--r5) 28%, #241f33), #241f33 60%) padding-box,
    conic-gradient(from var(--tour), #ff3d7f, #ffcc4d, #4cc16d, #3d8bfd, #a35cf0, #ff3d7f) border-box;
  box-shadow: 0 0 20px color-mix(in srgb, var(--r5) 50%, transparent);
  animation: bord 4s linear infinite;
}
@keyframes bord { to { --tour: 360deg; } }
/* Carte pas encore trouvée */
.carte.inconnue {
  opacity: .5; background: #1a1622; border-style: dashed;
  align-items: center; justify-content: center; font-size: 30cqw; color: #3a3450;
}

/* ---------- Effets à la révélation (seulement pendant l'ouverture) ---------- */
.retournee .carte.r1 { box-shadow: 0 0 14px var(--c); }
.retournee .carte:is(.r2, .r3, .r4) { animation: halo 1.6s ease-in-out infinite; }
.retournee .carte.r5 { animation: halo 1.1s ease-in-out infinite, bord 4s linear infinite; }
@keyframes halo {
  0%, 100% { box-shadow: 0 0 12px 2px var(--c); }
  50% { box-shadow: 0 0 42px 10px var(--c); }
}
/* Reflet brillant qui balaie la carte (Ultra rare et plus) */
.retournee .carte:is(.r3, .r4, .r5)::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(105deg, transparent 40%, rgba(255, 255, 255, .5) 50%, transparent 60%);
  background-size: 300% 100%; animation: reflet 2.6s ease-in-out infinite;
}
@keyframes reflet { 0% { background-position: 100% 0; } 60%, 100% { background-position: 0 0; } }
/* Reflet arc-en-ciel qui suit le doigt (Mythique) */
.retournee .carte.r5::before {
  content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background: linear-gradient(125deg, #ff3d7f, #ffcc4d, #4cc16d, #3d8bfd, #a35cf0, #ff3d7f);
  background-size: 400% 400%;
  background-position: calc(var(--x, 50) * 1%) calc(var(--y, 50) * 1%);
  mix-blend-mode: color-dodge; opacity: .35; animation: holo 4s linear infinite;
}
@keyframes holo { to { filter: hue-rotate(360deg); } }
/* Rayons qui tournent derrière une Mythique */
.rayons {
  position: absolute; inset: -55%; pointer-events: none;
  background: repeating-conic-gradient(color-mix(in srgb, var(--r5) 45%, transparent) 0 10deg, transparent 10deg 20deg);
  -webkit-mask: radial-gradient(circle, #000 15%, transparent 62%);
  mask: radial-gradient(circle, #000 15%, transparent 62%);
  animation: tourne 12s linear infinite, apparait .6s ease-out;
}
@keyframes tourne { to { rotate: 360deg; } }
@keyframes apparait { from { opacity: 0; scale: .4; } }
/* Étincelles (Légendaire et Mythique) */
.etincelle {
  position: absolute; left: 50%; top: 50%; z-index: 2; width: 8px; height: 8px; margin: -4px;
  border-radius: 50%; background: var(--c); box-shadow: 0 0 10px var(--c); pointer-events: none;
  animation: eclate 1s var(--delai, 0s) ease-out both;
}
@keyframes eclate {
  from { opacity: 1; transform: none; }
  to { opacity: 0; transform: translate(var(--dx), var(--dy)) scale(.3); }
}
/* Flash de l'écran (Mythique) */
#flash {
  position: fixed; inset: 0; z-index: 10; pointer-events: none; opacity: 0;
  background: radial-gradient(circle, #fff, var(--r5) 75%);
}
#flash.actif { animation: flash .7s ease-out; }
@keyframes flash { from { opacity: .9; } to { opacity: 0; } }

/* ---------- Collection ---------- */
.surtitre { font: 700 .8rem var(--mono); letter-spacing: .15em; color: var(--r5); margin: 8px 0 4px; }
.grand-titre { font-size: clamp(2.2rem, 9vw, 3.6rem); letter-spacing: -.04em; line-height: 1; text-align: left; margin: 0 0 16px; }
.chiffres { display: flex; flex-wrap: wrap; gap: 10px 32px; margin-bottom: 20px; }
.chiffres b { display: block; font-size: 2.2rem; font-weight: 900; letter-spacing: -.03em; line-height: 1; }
.chiffres b span { color: var(--sombre); }
.chiffres b.r5 { color: var(--r5); }
.chiffres small { font-size: .72rem; color: var(--discret); letter-spacing: .06em; }
#recherche { width: 100%; }
.filtres { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.filtre {
  display: flex; align-items: center; gap: 7px; padding: 8px 14px; border-radius: 99px;
  background: var(--panneau); border: 1px solid var(--bord); color: var(--texte); font-weight: 500; font-size: .85rem;
}
.filtre::before {
  content: ""; width: 9px; height: 9px; border-radius: 50%;
  background: var(--c, conic-gradient(var(--r5), var(--r4), var(--r1), var(--r2), var(--r3), var(--r5)));
}
.filtre.actif { background: var(--texte); color: #120f1a; }
.selecteurs { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 16px; }
.selecteurs label { flex-direction: row; align-items: center; gap: 8px; }
.selecteurs select { padding: 9px 12px; }
.vide { color: var(--discret); text-align: center; }

/* Grilles (récap et collection) */
.grille { width: 100%; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.grille .carte { aspect-ratio: 5 / 7; }
