/* ==========================================================================
   Cartes de Vaeloria — feuille du module.

   Préfixes : `tcg-` pour le jeu (front), `cards-` pour les petites pièces partagées avec le
   back-office (pastille de rareté, vignette de liste).

   Les raretés et les thèmes de deck sont des listes fermées (cf. Rarity::TIERS, Deck::THEMES) :
   leurs teintes sont des jetons RGB définis ici une fois, consommés partout par `rgb(var(--x))`.
   Les jetons du site (`--primary-rgb`, `--secondary-rgb`) sont toujours lus avec une valeur de
   repli : un jeton absent dégrade la teinte au lieu d'effacer la déclaration entière.
   ========================================================================== */

:root {
    --tcg-common: 148, 163, 184;
    --tcg-uncommon: 74, 222, 128;
    --tcg-rare: 56, 189, 248;
    --tcg-epic: 192, 132, 252;
    --tcg-legendary: 251, 191, 36;
    --tcg-mythic: 244, 114, 182;

    --tcg-ink: 255, 255, 255;
    --tcg-night: 10, 8, 24;

    --tcg-primary: var(--primary-rgb, 85, 107, 47);
    --tcg-secondary: var(--secondary-rgb, 200, 121, 65);
    --tcg-radius: 1rem;
}

/* ---- Raretés : une teinte par palier ------------------------------------ */
.tcg-card--common, .cards-dot--common, .tcg-tier--common { --tier: var(--tcg-common); }
.tcg-card--uncommon, .cards-dot--uncommon, .tcg-tier--uncommon { --tier: var(--tcg-uncommon); }
.tcg-card--rare, .cards-dot--rare, .tcg-tier--rare { --tier: var(--tcg-rare); }
.tcg-card--epic, .cards-dot--epic, .tcg-tier--epic { --tier: var(--tcg-epic); }
.tcg-card--legendary, .cards-dot--legendary, .tcg-tier--legendary { --tier: var(--tcg-legendary); }
.tcg-card--mythic, .cards-dot--mythic, .tcg-tier--mythic { --tier: var(--tcg-mythic); }

/* ---- Thèmes de deck : deux tons, clair et profond ----------------------- */
.tcg-theme--arcane, .cards-dot--theme-arcane { --theme-a: 124, 58, 237; --theme-b: 30, 22, 70; }
.tcg-theme--emerald, .cards-dot--theme-emerald { --theme-a: 16, 160, 110; --theme-b: 6, 44, 36; }
.tcg-theme--crimson, .cards-dot--theme-crimson { --theme-a: 200, 38, 48; --theme-b: 58, 10, 16; }
.tcg-theme--gold, .cards-dot--theme-gold { --theme-a: 202, 148, 52; --theme-b: 60, 38, 8; }
.tcg-theme--azure, .cards-dot--theme-azure { --theme-a: 37, 99, 235; --theme-b: 10, 26, 68; }
.tcg-theme--shadow, .cards-dot--theme-shadow { --theme-a: 90, 104, 128; --theme-b: 14, 20, 36; }

/* ---- Pièces partagées avec le back-office ------------------------------- */
.cards-dot {
    display: inline-block;
    width: .7rem;
    height: .7rem;
    border-radius: 50%;
    vertical-align: middle;
    background: rgb(var(--tier, var(--theme-a, var(--tcg-common))));
    box-shadow: 0 0 0 2px rgba(var(--tier, var(--tcg-common)), .25);
}

/* Vignette des listes du back-office : dimensions figées, quelle que soit la taille du fichier. */
.cards-admin-thumb-col { width: 70px; }

.cards-admin-thumb {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.6rem;
    min-width: 2.6rem;
    max-width: 2.6rem;
    height: 3.6rem;
    object-fit: cover;
    object-position: center 30%;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .2);
}

.cards-admin-thumb--empty {
    background: rgba(var(--tcg-common), .15);
    color: rgba(var(--tcg-common), .9);
}

/* ==========================================================================
   La carte
   ========================================================================== */

/* `--tier` et `--theme-*` viennent des classes de rareté et de thème, toujours posées par le
   gabarit : ne pas les redéfinir ici, cette règle-ci (plus bas dans la feuille) les écraserait. */
.tcg-card {
    --rx: 0deg;
    --ry: 0deg;
    --mx: 50%;
    --my: 50%;
    position: relative;
    flex: 0 0 auto;
    width: 15.5em;
    aspect-ratio: 63 / 88;
    font-size: 14px;
    perspective: 900px;
    color: rgb(var(--tcg-ink));
    text-align: left;
}

.tcg-card--xs { font-size: 8.5px; }
.tcg-card--sm { font-size: 10px; }
.tcg-card--lg { font-size: 18px; }

.tcg-card__inner {
    position: absolute;
    inset: 0;
    border-radius: .9em;
    overflow: hidden;
    transform: rotateX(var(--rx)) rotateY(var(--ry));
    transform-style: preserve-3d;
    transition: transform .25s ease, box-shadow .25s ease;
    /* La bordure est le fond de l'enveloppe, visible autour du cadre : c'est la couleur de rareté. */
    background: linear-gradient(145deg, rgba(var(--tier), 1), rgba(var(--tier), .55) 45%, rgba(var(--tier), .95));
    box-shadow: 0 .7em 1.6em rgba(0, 0, 0, .35), 0 0 0 1px rgba(0, 0, 0, .25);
}

.tcg-card__frame {
    position: absolute;
    inset: .42em;
    z-index: 1;
    display: flex;
    flex-direction: column;
    gap: .35em;
    padding: .5em;
    border-radius: .62em;
    background:
        radial-gradient(120% 60% at 50% 0%, rgba(var(--theme-a), .55), transparent 70%),
        linear-gradient(170deg, rgb(var(--theme-a)), rgb(var(--theme-b)) 62%);
    border: 1px solid rgba(var(--tcg-ink), .14);
}

.tcg-card__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .4em;
    padding: .15em .35em;
    border-radius: .4em;
    background: rgba(0, 0, 0, .28);
}

.tcg-card__name {
    font-family: "Marcellus", Georgia, serif;
    font-size: 1.08em;
    font-weight: 700;
    line-height: 1.15;
    letter-spacing: .01em;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tcg-card__gem {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.7em;
    height: 1.7em;
    border-radius: 50%;
    font-size: .8em;
    color: rgb(var(--tcg-night));
    background: radial-gradient(circle at 35% 30%, rgba(var(--tcg-ink), .95), rgb(var(--tier)) 55%);
    box-shadow: 0 0 .6em rgba(var(--tier), .8);
}

.tcg-card__art {
    position: relative;
    flex: 0 0 44%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border-radius: .45em;
    background:
        radial-gradient(circle at 50% 40%, rgba(var(--tier), .35), transparent 65%),
        rgba(0, 0, 0, .35);
    box-shadow: inset 0 0 0 1px rgba(var(--tcg-ink), .12), inset 0 -1.5em 2em rgba(0, 0, 0, .35);
}

.tcg-card__art img {
    object-position: center 30%;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.tcg-card__placeholder {
    font-size: 3.4em;
    color: rgba(var(--tcg-ink), .82);
    filter: drop-shadow(0 0 .35em rgba(var(--tier), .9));
}

.tcg-card__type {
    margin: 0;
    font-size: .68em;
    font-style: italic;
    letter-spacing: .02em;
    color: rgba(var(--tcg-ink), .78);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tcg-card__body {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    gap: .35em;
    min-height: 0;
}

.tcg-card__stats {
    display: flex;
    flex-wrap: wrap;
    gap: .25em;
    margin: 0;
}

.tcg-card__stat {
    display: flex;
    gap: .3em;
    align-items: baseline;
    padding: .12em .45em;
    border-radius: 2em;
    font-size: .7em;
    background: rgba(0, 0, 0, .3);
    border: 1px solid rgba(var(--tier), .45);
}

.tcg-card__stat dt { font-weight: 400; color: rgba(var(--tcg-ink), .7); }
.tcg-card__stat dd { margin: 0; font-weight: 700; }

.tcg-card__flavor {
    margin: 0;
    font-size: .68em;
    font-style: italic;
    line-height: 1.35;
    color: rgba(var(--tcg-ink), .82);
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.tcg-card__foot {
    display: flex;
    justify-content: space-between;
    gap: .4em;
    font-size: .6em;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: rgba(var(--tcg-ink), .7);
}

.tcg-card__rarity { color: rgb(var(--tier)); font-weight: 700; }

/* Reflet qui suit le pointeur (piloté par --mx / --my). */
.tcg-card__glare {
    position: absolute;
    inset: 0;
    z-index: 3;
    pointer-events: none;
    opacity: 0;
    transition: opacity .25s ease;
    background: radial-gradient(circle at var(--mx) var(--my), rgba(var(--tcg-ink), .38), transparent 45%);
    mix-blend-mode: overlay;
}

.tcg-card:hover .tcg-card__glare,
.tcg-card.is-tilting .tcg-card__glare { opacity: 1; }

/* Irisation des brillantes. */
.tcg-card__shine {
    position: absolute;
    inset: 0;
    z-index: 2;
    pointer-events: none;
    opacity: 0;
}

.tcg-card.is-foil .tcg-card__shine {
    opacity: .75;
    background:
        repeating-linear-gradient(115deg,
            rgba(255, 0, 128, .0) 0%,
            rgba(255, 0, 128, .32) 8%,
            rgba(255, 220, 0, .32) 16%,
            rgba(0, 255, 160, .32) 24%,
            rgba(0, 170, 255, .32) 32%,
            rgba(170, 0, 255, .32) 40%,
            rgba(255, 0, 128, .0) 48%);
    background-size: 300% 300%;
    background-position: var(--mx) var(--my);
    mix-blend-mode: color-dodge;
    animation: tcg-foil 6s linear infinite;
}

.tcg-card.is-foil.is-tilting .tcg-card__shine { animation: none; }

@keyframes tcg-foil {
    from { background-position: 0% 50%; }
    to { background-position: 300% 50%; }
}

/* Paliers hauts : la bordure vit. */
.tcg-card--epic .tcg-card__inner {
    box-shadow: 0 .7em 1.6em rgba(0, 0, 0, .35), 0 0 1.1em rgba(var(--tier), .45);
}

.tcg-card--legendary .tcg-card__inner {
    background: linear-gradient(120deg, rgb(var(--tier)), rgb(255, 245, 200), rgb(var(--tier)), rgb(180, 120, 20), rgb(var(--tier)));
    background-size: 300% 300%;
    animation: tcg-gold 5s ease-in-out infinite;
    box-shadow: 0 .7em 1.6em rgba(0, 0, 0, .35), 0 0 1.4em rgba(var(--tier), .6);
}

@keyframes tcg-gold {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

.tcg-card--mythic .tcg-card__inner {
    background: transparent;
    box-shadow: 0 .7em 1.6em rgba(0, 0, 0, .35), 0 0 1.6em rgba(var(--tier), .7);
}

.tcg-card--mythic .tcg-card__inner::before {
    content: "";
    position: absolute;
    inset: -60%;
    z-index: 0;
    background: conic-gradient(from 0deg, #ff4fa3, #ffd84f, #4fffb0, #4fc3ff, #b44fff, #ff4fa3);
    animation: tcg-spin 4s linear infinite;
}

@keyframes tcg-spin { to { transform: rotate(360deg); } }

/* ---- Full art : l'illustration couvre toute la carte -------------------
   Même balisage que la carte standard ; seule la mise en page change. L'illustration passe en
   fond du cadre, les textes se posent par-dessus sur deux voiles sombres (haut et bas) qui
   garantissent la lisibilité quel que soit le dessin. */
.tcg-card--full .tcg-card__frame {
    padding: .5em;
    background: rgb(var(--theme-b));
    overflow: hidden;
}

.tcg-card--full .tcg-card__art {
    position: absolute;
    inset: 0;
    z-index: 0;
    flex: none;
    border-radius: inherit;
    background: rgb(var(--theme-b));
    box-shadow: none;
}

.tcg-card--full .tcg-card__art img { object-position: center 25%; }

.tcg-card--full .tcg-card__art::after {
    content: "";
    position: absolute;
    inset: 0;
    background:
        linear-gradient(180deg, rgba(0, 0, 0, .62) 0%, rgba(0, 0, 0, 0) 22%),
        linear-gradient(0deg, rgba(0, 0, 0, .86) 0%, rgba(0, 0, 0, .45) 28%, rgba(0, 0, 0, 0) 48%);
}

.tcg-card--full .tcg-card__head,
.tcg-card--full .tcg-card__type,
.tcg-card--full .tcg-card__body,
.tcg-card--full .tcg-card__foot {
    position: relative;
    z-index: 1;
}

.tcg-card--full .tcg-card__head { background: rgba(0, 0, 0, .35); backdrop-filter: blur(2px); }

/* Les textes descendent en bas de la carte : le haut reste au dessin. */
.tcg-card--full .tcg-card__type { order: 1; margin-top: auto; text-shadow: 0 1px 3px rgba(0, 0, 0, .9); }
.tcg-card--full .tcg-card__body { order: 2; flex: none; }
.tcg-card--full .tcg-card__foot { order: 3; }
.tcg-card--full .tcg-card__flavor { -webkit-line-clamp: 3; text-shadow: 0 1px 3px rgba(0, 0, 0, .9); }
.tcg-card--full .tcg-card__stat { background: rgba(0, 0, 0, .5); }
.tcg-card--full .tcg-card__placeholder { position: absolute; top: 38%; left: 50%; transform: translate(-50%, -50%); }

/* Le liseré de rareté reste visible : sur une full art, c'est lui qui dit la valeur de la carte. */
.tcg-card--full .tcg-card__frame { box-shadow: inset 0 0 0 1px rgba(var(--tier), .55); }

/* ---- EX : mise en page classique, cadre chromé, reflet et sceau --------- */
.tcg-card--ex .tcg-card__inner {
    background: linear-gradient(115deg, #c9d2e3, #ffffff 18%, #9aa7bd 32%, #f4f7ff 48%, #8e9bb3 64%, #ffffff 80%, #b7c2d6);
    background-size: 250% 250%;
    animation: tcg-chrome 6s linear infinite;
    box-shadow: 0 .7em 1.6em rgba(0, 0, 0, .4), 0 0 1.4em rgba(var(--tier), .55);
}

@keyframes tcg-chrome {
    from { background-position: 0% 50%; }
    to { background-position: 250% 50%; }
}

/* Reflet qui balaie la carte en continu : une EX se reconnaît de loin. */
.tcg-card--ex .tcg-card__frame::after {
    content: "";
    position: absolute;
    inset: -20%;
    z-index: 2;
    pointer-events: none;
    background: linear-gradient(105deg, transparent 40%, rgba(255, 255, 255, .28) 48%, rgba(255, 255, 255, 0) 56%);
    transform: translateX(-60%);
    animation: tcg-sweep 4.5s ease-in-out infinite;
}

@keyframes tcg-sweep {
    0%, 55% { transform: translateX(-60%); }
    100% { transform: translateX(60%); }
}

/* Le sceau EX : une plaque dorée pleine, lisible sur n'importe quel dessin (un texte doré
   transparent disparaissait sur les fonds sombres). */
.tcg-card__ex {
    flex: 0 0 auto;
    margin-left: auto;
    padding: .12em .42em .1em;
    border-radius: .3em;
    font-family: "Marcellus", Georgia, serif;
    font-size: .95em;
    font-weight: 800;
    font-style: italic;
    letter-spacing: .02em;
    line-height: 1;
    color: #3a1f00;
    background: linear-gradient(180deg, #fff3c4 0%, #ffd25e 40%, #d9901f 60%, #ffe29a 100%);
    box-shadow: 0 0 0 1px rgba(80, 40, 0, .55), 0 0 .5em rgba(255, 200, 80, .75);
    text-shadow: 0 1px 0 rgba(255, 255, 255, .55);
}

/* Pastilles posées sur la carte. */
.tcg-card__ribbon,
.tcg-card__count,
.tcg-card__foil-mark {
    position: absolute;
    z-index: 4;
    font-weight: 700;
    line-height: 1;
    pointer-events: none;
}

.tcg-card__ribbon {
    top: -.55em;
    left: 50%;
    transform: translateX(-50%);
    padding: .35em .8em;
    border-radius: 2em;
    font-size: .75em;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: rgb(var(--tcg-night));
    background: rgb(var(--tcg-legendary));
    box-shadow: 0 .3em .8em rgba(var(--tcg-legendary), .55);
}

.tcg-card__count {
    right: -.45em;
    top: -.45em;
    padding: .38em .6em;
    border-radius: 2em;
    font-size: .8em;
    color: rgb(var(--tcg-ink));
    background: rgb(var(--tcg-primary));
    box-shadow: 0 .2em .6em rgba(0, 0, 0, .3);
}

.tcg-card__foil-mark {
    left: -.45em;
    top: -.45em;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1.9em;
    height: 1.9em;
    border-radius: 50%;
    font-size: .8em;
    color: rgb(var(--tcg-night));
    background: linear-gradient(135deg, #ffd6f0, #fff3b0, #c6ffe9, #c6e4ff);
    box-shadow: 0 .2em .6em rgba(0, 0, 0, .3);
}

/* Non possédée : présente mais éteinte. */
.tcg-card.is-missing .tcg-card__inner {
    filter: grayscale(1) brightness(.55);
    box-shadow: none;
}

.tcg-card.is-missing { opacity: .8; }

.tcg-card.is-clickable { cursor: pointer; }

.tcg-card.is-clickable:hover .tcg-card__inner,
.tcg-card.is-clickable:focus-visible .tcg-card__inner {
    box-shadow: 0 1.1em 2.2em rgba(0, 0, 0, .4), 0 0 1.2em rgba(var(--tier), .55);
}

.tcg-card.is-clickable:focus-visible { outline: 3px solid rgba(var(--tier), .9); outline-offset: 4px; border-radius: 1em; }

/* ==========================================================================
   Mise en page des pages du jeu
   ========================================================================== */

.tcg-hero {
    position: relative;
    overflow: hidden;
    background:
        radial-gradient(90% 120% at 50% -20%, rgba(var(--tcg-primary), .22), transparent 62%),
        radial-gradient(50% 80% at 90% 10%, rgba(var(--tcg-secondary), .14), transparent 70%),
        linear-gradient(180deg, rgba(var(--tcg-primary), .08), rgba(var(--tcg-primary), .01));
    border-bottom: 1px solid rgba(var(--tcg-primary), .16);
}

/* ---- Coquille : barre latérale des sections + contenu ------------------
   Sous le bandeau, la barre colle sous la navbar (`sticky-column-offnav` du site règle le `top`
   selon que la navbar est affichée ou masquée). Repliée, elle devient un rail d'icônes. */
.tcg-shell { display: flex; align-items: stretch; }
.tcg-shell__main { flex: 1 1 auto; min-width: 0; }

.tcg-side {
    flex: 0 0 15rem;
    width: 15rem;
    background: rgba(var(--tcg-primary), .04);
    border-right: 1px solid rgba(var(--tcg-primary), .14);
    transition: flex-basis .25s ease, width .25s ease;
}

.tcg-side__inner {
    position: sticky;
    display: flex;
    flex-direction: column;
    gap: .25rem;
    max-height: calc(100vh - 95px);
    overflow-y: auto;
    padding: 1rem .7rem;
}

.tcg-side__nav { display: flex; flex-direction: column; gap: .25rem; }

.tcg-side__link,
.tcg-side__toggle {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .6rem .85rem;
    border: 0;
    border-radius: .75rem;
    background: none;
    color: inherit;
    font-weight: 600;
    text-align: left;
    text-decoration: none;
    white-space: nowrap;
    transition: background-color .2s ease, color .2s ease;
}
.tcg-side__link:hover, .tcg-side__toggle:hover { background: rgba(var(--tcg-primary), .12); color: inherit; }
.tcg-side__link.is-active { background: rgb(var(--tcg-primary)); color: rgb(var(--tcg-ink)); }
.tcg-side__link i { color: rgb(var(--tcg-primary)); }
.tcg-side__link.is-active i { color: inherit; }

.tcg-side__toggle {
    margin-top: .5rem;
    padding-top: .75rem;
    border-top: 1px solid rgba(var(--tcg-primary), .14);
    border-radius: 0 0 .75rem .75rem;
    font-size: .85rem;
    opacity: .7;
}
.tcg-side__toggle i { transition: transform .25s ease; }

.tcg-side.is-collapsed { flex-basis: 4.4rem; width: 4.4rem; }
.tcg-side.is-collapsed .tcg-side__label { display: none; }
.tcg-side.is-collapsed .tcg-side__link,
.tcg-side.is-collapsed .tcg-side__toggle { justify-content: center; padding-inline: 0; }
.tcg-side.is-collapsed .tcg-side__toggle i { transform: rotate(180deg); }

/* Petit écran : une rangée d'onglets défilante au-dessus du contenu, jamais repliée. */
@media (max-width: 991.98px) {
    .tcg-shell { display: block; }
    .tcg-side, .tcg-side.is-collapsed {
        width: auto;
        border-right: 0;
        border-bottom: 1px solid rgba(var(--tcg-primary), .14);
    }
    .tcg-side__inner { position: static; max-height: none; padding: .6rem 16px; }
    .tcg-side__nav { flex-direction: row; overflow-x: auto; scrollbar-width: none; }
    .tcg-side.is-collapsed .tcg-side__label { display: inline; }
    .tcg-side.is-collapsed .tcg-side__link { padding-inline: .85rem; }
    .tcg-side__toggle { display: none; }
}

@media (prefers-reduced-motion: reduce) {
    .tcg-side, .tcg-side__toggle i { transition: none; }
}

/* Ancre « Voir mon historique » : l'historique ne finit pas sous la navbar. */
.tcg-history-block { scroll-margin-top: 95px; }

/* ---- Participants -------------------------------------------------------- */
.tcg-people {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr));
    gap: 1.2rem;
}
.tcg-person { display: flex; flex-direction: column; }
.tcg-person.is-me { box-shadow: inset 3px 0 0 rgb(var(--tcg-primary)); }
.tcg-person .tcg-progress { max-width: none; }
.tcg-person__avatar {
    flex: 0 0 3rem;
    width: 3rem;
    height: 3rem;
    border-radius: 50%;
    object-fit: cover;
}
.tcg-person__avatar--empty {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(var(--tcg-primary), .15);
    color: rgb(var(--tcg-primary));
    font-weight: 700;
    font-size: 1.2rem;
}

/* Les panneaux du jeu prennent la carte claire du site (`bg-light shadow-sm`, posées dans le
   gabarit) : cette règle ne fait que l'arrondi et l'espacement. */
.tcg-panel {
    padding: 1.5rem;
    border-radius: var(--tcg-radius);
}

.tcg-panel--flat { padding: 1rem; }

.tcg-notice {
    padding: .9rem 1.2rem;
    border-radius: var(--tcg-radius);
    background: rgba(var(--tcg-secondary), .1);
    border: 1px solid rgba(var(--tcg-secondary), .3);
}

/* ---- Quotidien ---------------------------------------------------------- */
.tcg-daily__pack {
    display: flex;
    justify-content: center;
    margin: .5rem 0 1.4rem;
    opacity: .6;
    filter: grayscale(.35);
    transition: opacity .3s ease, filter .3s ease;
}

.tcg-daily__pack.is-ready { opacity: 1; filter: none; }
.tcg-daily__pack.is-ready .tcg-pack { animation: tcg-pack-wiggle 3s ease-in-out infinite; }

@keyframes tcg-pack-wiggle {
    0%, 70%, 100% { transform: rotate(-3deg) translateY(0); }
    76% { transform: rotate(3deg) translateY(-6px); }
    82% { transform: rotate(-4deg) translateY(-6px); }
    88% { transform: rotate(2deg) translateY(0); }
}

.tcg-streak { display: flex; justify-content: center; gap: .35rem; }

.tcg-streak__dot {
    width: .7rem;
    height: .7rem;
    border-radius: 50%;
    background: rgba(var(--tcg-primary), .15);
}

.tcg-streak__dot.is-on { background: rgb(var(--tcg-secondary)); }
.tcg-streak__dot.is-bonus { box-shadow: 0 0 0 2px rgba(var(--tcg-secondary), .45); }

/* Réserve de boosters offerts : une case par booster, pleine = prête à récupérer. */
.tcg-reserve { display: flex; justify-content: center; gap: .4rem; }

.tcg-reserve__slot {
    width: 1.1rem;
    height: 1.5rem;
    border-radius: .25rem;
    border: 2px solid rgba(var(--tcg-primary), .25);
}

.tcg-reserve__slot.is-on {
    border-color: rgb(var(--tcg-secondary));
    background: rgba(var(--tcg-secondary), .85);
}

/* ---- Paquets ------------------------------------------------------------ */
.tcg-stock {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(7.5rem, 1fr));
    gap: 1.4rem 1rem;
}

.tcg-stock__item { margin: 0; display: flex; justify-content: center; }
.tcg-stock__empty { grid-column: 1 / -1; }

.tcg-stock__btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .6rem;
    padding: 0;
    border: 0;
    background: none;
    cursor: pointer;
}

.tcg-stock__cta {
    font-size: .85rem;
    font-weight: 600;
    color: rgb(var(--tcg-primary));
}

.tcg-stock__btn:hover .tcg-pack,
.tcg-stock__btn:focus-visible .tcg-pack {
    transform: translateY(-8px) rotate(-3deg);
    box-shadow: 0 1.2rem 2rem rgba(0, 0, 0, .3), 0 0 1.4rem rgba(var(--theme-a), .55), inset 0 0 0 2px rgba(var(--tcg-ink), .3);
}

.tcg-pack {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    width: 7rem;
    aspect-ratio: 63 / 100;
    padding: .7rem .5rem;
    border-radius: .5rem .5rem .8rem .8rem;
    overflow: hidden;
    color: rgb(var(--tcg-ink));
    background:
        radial-gradient(90% 55% at 50% 30%, rgba(var(--tcg-ink), .22), transparent 70%),
        linear-gradient(165deg, rgb(var(--theme-a)), rgb(var(--theme-b)));
    box-shadow: 0 .6rem 1.2rem rgba(0, 0, 0, .25), inset 0 0 0 2px rgba(var(--tcg-ink), .16);
    transition: transform .25s ease, box-shadow .25s ease;
}

.tcg-pack--md { width: 9rem; }

/* Le sertissage du haut : la languette que l'on déchire. */
.tcg-pack::before {
    content: "";
    position: absolute;
    inset: 0 0 auto;
    height: 11%;
    background: repeating-linear-gradient(90deg, rgba(var(--tcg-ink), .32) 0 3px, rgba(var(--tcg-ink), .08) 3px 6px);
    border-bottom: 2px dashed rgba(var(--tcg-ink), .4);
}

/* Le reflet du film plastique. */
.tcg-pack::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(115deg, transparent 30%, rgba(var(--tcg-ink), .22) 45%, transparent 55%);
    pointer-events: none;
}

.tcg-pack__img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }

.tcg-pack__crest {
    position: absolute;
    top: 38%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 2.3rem;
    filter: drop-shadow(0 0 .6rem rgba(var(--tcg-ink), .35));
}

.tcg-pack--md .tcg-pack__crest { font-size: 3rem; }

.tcg-pack__brand {
    position: relative;
    font-size: .55rem;
    letter-spacing: .14em;
    text-transform: uppercase;
    opacity: .8;
}

.tcg-pack__name {
    position: relative;
    font-family: "Marcellus", Georgia, serif;
    font-size: .85rem;
    font-weight: 700;
    line-height: 1.15;
    text-align: center;
    text-shadow: 0 1px 3px rgba(0, 0, 0, .6);
}

.tcg-pack--md .tcg-pack__name { font-size: 1rem; }

.tcg-pack__qty {
    position: absolute;
    top: 15%;
    right: .35rem;
    padding: .2rem .45rem;
    border-radius: 2rem;
    font-size: .75rem;
    font-weight: 800;
    color: rgb(var(--tcg-night));
    background: rgb(var(--tcg-legendary));
}

/* ---- Boutique ----------------------------------------------------------- */
.tcg-offer__visual {
    display: flex;
    justify-content: center;
    padding: 1.6rem 0 1.2rem;
    background: radial-gradient(70% 70% at 50% 60%, rgba(var(--tcg-primary), .08), transparent 70%);
}

.tcg-offer .tcg-pack { transform: rotate(-4deg); }
.tcg-offer:hover .tcg-pack { transform: rotate(0) translateY(-6px); }

.tcg-odds summary { cursor: pointer; color: rgb(var(--tcg-primary)); font-weight: 600; }

/* ---- Boîtes de decks : trois cartes en éventail ------------------------- */
.tcg-box {
    display: block;
    color: inherit;
}

.tcg-box__fan {
    position: relative;
    height: 15rem;
    margin-bottom: 1rem;
}

.tcg-box__slot {
    position: absolute;
    left: 50%;
    bottom: 0;
    transform-origin: 50% 110%;
    transition: transform .35s cubic-bezier(.2, .8, .2, 1.2);
}

.tcg-box__slot--0 { transform: translateX(-50%) rotate(0deg); z-index: 3; }
.tcg-box__slot--1 { transform: translateX(-50%) rotate(-11deg); z-index: 2; }
.tcg-box__slot--2 { transform: translateX(-50%) rotate(11deg); z-index: 1; }

.tcg-box:hover .tcg-box__slot--0 { transform: translateX(-50%) translateY(-10px); }
.tcg-box:hover .tcg-box__slot--1 { transform: translateX(-50%) rotate(-20deg) translateX(-8px); }
.tcg-box:hover .tcg-box__slot--2 { transform: translateX(-50%) rotate(20deg) translateX(8px); }

.tcg-box__label { display: flex; flex-direction: column; gap: .35rem; text-align: center; }
.tcg-box__name { font-size: 1.25rem; font-weight: 700; color: var(--body-text, inherit); }
.tcg-box__meta { font-size: .85rem; color: rgba(0, 0, 0, .55); }

/* Dos de carte, pour une boîte encore vide. */
.tcg-back {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 9.5rem;
    aspect-ratio: 63 / 88;
    border-radius: .7rem;
    background:
        radial-gradient(circle, rgba(var(--tcg-ink), .16), transparent 50%),
        repeating-linear-gradient(45deg, rgba(var(--tcg-ink), .05) 0 6px, transparent 6px 12px),
        linear-gradient(160deg, rgb(var(--theme-a)), rgb(var(--theme-b)));
    box-shadow: 0 .5rem 1rem rgba(0, 0, 0, .25), inset 0 0 0 .3rem rgba(var(--tcg-ink), .12), inset 0 0 0 .42rem rgba(var(--tcg-legendary), .45);
    color: rgba(var(--tcg-legendary), .85);
    font-size: 2.6rem;
}

.tcg-progress {
    display: block;
    width: 100%;
    max-width: 14rem;
    margin: 0 auto;
    height: .35rem;
    border-radius: 1rem;
    overflow: hidden;
    background: rgba(var(--tcg-primary), .12);
}

.tcg-progress--lg { max-width: 22rem; margin: 0; height: .55rem; }

.tcg-progress__bar {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: rgb(var(--tcg-primary));
    transition: width .6s ease;
}

.tcg-progress--lg .tcg-progress__bar { background: linear-gradient(90deg, rgb(var(--tcg-primary)), rgb(var(--tcg-secondary))); }

/* Largeurs par pas de 5 % : la progression n'a pas besoin de `style` inline. */
.tcg-w-0 { width: 0; } .tcg-w-5 { width: 5%; } .tcg-w-10 { width: 10%; } .tcg-w-15 { width: 15%; }
.tcg-w-20 { width: 20%; } .tcg-w-25 { width: 25%; } .tcg-w-30 { width: 30%; } .tcg-w-35 { width: 35%; }
.tcg-w-40 { width: 40%; } .tcg-w-45 { width: 45%; } .tcg-w-50 { width: 50%; } .tcg-w-55 { width: 55%; }
.tcg-w-60 { width: 60%; } .tcg-w-65 { width: 65%; } .tcg-w-70 { width: 70%; } .tcg-w-75 { width: 75%; }
.tcg-w-80 { width: 80%; } .tcg-w-85 { width: 85%; } .tcg-w-90 { width: 90%; } .tcg-w-95 { width: 95%; }
.tcg-w-100 { width: 100%; }

/* ---- Fil des belles prises & classement --------------------------------- */
.tcg-feed {
    display: flex;
    gap: 1.4rem;
    padding: .8rem .2rem 1rem;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
}

.tcg-feed__item { scroll-snap-align: start; }

.tcg-board__row {
    display: flex;
    align-items: center;
    gap: .8rem;
    padding: .55rem 0;
    border-bottom: 1px solid rgba(var(--tcg-primary), .1);
}

.tcg-board__rank {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.8rem;
    height: 1.8rem;
    border-radius: 50%;
    font-family: "Marcellus", Georgia, serif;
    font-weight: 700;
    background: rgba(var(--tcg-primary), .1);
}

.tcg-board__row:nth-child(1) .tcg-board__rank { background: rgb(var(--tcg-secondary)); color: rgb(var(--tcg-ink)); }
.tcg-board__name { flex: 1; font-weight: 600; text-decoration: none; }
.tcg-board__score { font-weight: 700; }

/* ---- Collection --------------------------------------------------------- */
.tcg-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(14.5em, 1fr));
    justify-items: center;
    gap: 2rem 1.2rem;
    font-size: 14px;
}

.tcg-grid--showcase { grid-template-columns: repeat(auto-fill, minmax(19em, 1fr)); }

.tcg-picker__menu { max-height: 22rem; overflow-y: auto; min-width: 16rem; }

/* Filtres : un groupe de liens texte soulignés, pas une rangée de gros boutons. */
.tcg-filters { display: flex; flex-wrap: wrap; gap: .3rem 1.2rem; border-bottom: 1px solid rgba(var(--tcg-primary), .12); }

.tcg-filters__item {
    padding: .45rem 0;
    margin-bottom: -1px;
    font-size: .95rem;
    color: rgba(0, 0, 0, .6);
    text-decoration: none;
    border-bottom: 2px solid transparent;
}

.tcg-filters__item:hover { color: rgb(var(--tcg-primary)); }
.tcg-filters__item.is-active { color: rgb(var(--tcg-primary)); font-weight: 600; border-bottom-color: rgb(var(--tcg-primary)); }

.tcg-glow { animation: tcg-glow 1.8s ease-in-out infinite; }

@keyframes tcg-glow {
    0%, 100% { box-shadow: 0 0 0 0 rgba(var(--tcg-legendary), .6); }
    50% { box-shadow: 0 0 0 10px rgba(var(--tcg-legendary), 0); }
}

/* ---- Créer ma carte ----------------------------------------------------- */
.tcg-member { position: relative; overflow: hidden; }

.tcg-member::before {
    content: "";
    position: absolute;
    inset: -40% auto -40% -15%;
    width: 55%;
    background: radial-gradient(circle, rgba(var(--tcg-secondary), .16), transparent 65%);
    pointer-events: none;
}

.tcg-member__preview { position: relative; font-size: 13px; }
.tcg-member__checks li { padding: .2rem 0; }
.tcg-member__checks .is-ok i { color: rgb(var(--tcg-primary)); }
.tcg-member__checks .is-warn { color: rgba(0, 0, 0, .6); }
.tcg-member__checks .is-warn i { color: rgb(var(--tcg-secondary)); }

/* ---- Fiche (modale) ----------------------------------------------------- */
.tcg-modal .modal-content { border-radius: 1.2rem; }
.tcg-modal .tcg-panel--flat { background: rgba(var(--tcg-primary), .05); }

.tcg-copies__row {
    display: flex;
    align-items: center;
    gap: .4rem;
    padding: .6rem 0;
    border-bottom: 1px solid rgba(var(--tcg-primary), .1);
}

.tcg-copies__row form { margin: 0; }

.tcg-sell {
    padding: .8rem;
    margin: .2rem 0 .6rem;
    border-radius: .8rem;
    background: rgba(var(--tcg-primary), .05);
}

/* ---- Boutons d'action du jeu --------------------------------------------
   Libellé en toutes lettres, icône alignée, hauteur commune : les boutons de MDB passent le texte
   en capitales et le décalent d'un demi-pixel selon la taille, d'où ce gabarit propre. Chaque
   variante garde un contraste d'au moins 4.5:1 sur le fond clair des panneaux. */
.tcg-act {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .45em;
    min-height: 2.25rem;
    padding: .35rem .8rem;
    font-weight: 600;
    line-height: 1.2;
    text-transform: none;
    letter-spacing: normal;
    white-space: nowrap;
    box-shadow: none;
}

.tcg-act.btn-sm { min-height: 2rem; padding: .3rem .7rem; font-size: .82rem; }
.tcg-act > i { flex-shrink: 0; }

.tcg-act--ghost {
    color: rgb(var(--tcg-primary));
    background: #fff;
    border: 1px solid rgba(var(--tcg-primary), .35);
}

.tcg-act--ghost:hover,
.tcg-act--ghost:focus-visible,
.tcg-act--ghost[aria-expanded="true"] {
    color: rgb(var(--tcg-primary));
    background: rgba(var(--tcg-primary), .1);
    border-color: rgb(var(--tcg-primary));
}

.tcg-act--on {
    color: #5c3a00;
    background: #fff1c7;
    border: 1px solid #e0a82e;
}

.tcg-act--on:hover, .tcg-act--on:focus-visible { color: #5c3a00; background: #ffe49a; }

.tcg-act--danger {
    color: #a3261d;
    background: #fff;
    border: 1px solid rgba(180, 35, 24, .35);
}

.tcg-act--danger:hover, .tcg-act--danger:focus-visible { color: #fff; background: #b42318; border-color: #b42318; }

.tcg-act__gain {
    display: inline-flex;
    align-items: center;
    gap: .25em;
    padding: .05em .45em;
    border-radius: 1em;
    font-size: .9em;
    background: rgba(180, 35, 24, .1);
}

.tcg-act--danger:hover .tcg-act__gain, .tcg-act--danger:focus-visible .tcg-act__gain { background: rgba(255, 255, 255, .2); }

/* Achat immédiat : ambre plein et texte brun foncé (≈ 9:1) — l'ancien contour jaune sur fond
   clair ne se lisait pas. */
.tcg-act--buyout {
    color: #3a2400;
    background: rgb(var(--tcg-legendary));
    border: 1px solid #c98a0b;
}

.tcg-act--buyout:hover, .tcg-act--buyout:focus-visible { color: #2a1a00; background: #f5ad0f; border-color: #a87106; }

.tcg-act__price {
    display: inline-flex;
    align-items: center;
    gap: .25em;
    margin-left: auto;
    padding: .05em .5em;
    border-radius: 1em;
    background: rgba(58, 36, 0, .12);
}

.tcg-act--buyout .tcg-act__price { margin-left: .2rem; }

/* Champ d'enchère + bouton : même hauteur, texte centré (l'input-group de MDB décalait le libellé). */
.tcg-bid { display: flex; gap: .4rem; align-items: stretch; }
.tcg-bid .form-control { flex: 1; min-width: 0; height: auto; }

/* ---- Exemplaires dans la fiche ------------------------------------------ */
.tcg-copy {
    padding: .75rem 0;
    border-bottom: 1px solid rgba(var(--tcg-primary), .1);
}

.tcg-copy:last-child { border-bottom: 0; }

.tcg-copy__head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: .2rem .6rem;
}

.tcg-copy__states { display: inline-flex; flex-wrap: wrap; gap: .3rem; margin-left: auto; }

.tcg-state {
    display: inline-flex;
    align-items: center;
    gap: .3em;
    padding: .15em .6em;
    border-radius: 2em;
    font-size: .75rem;
    font-weight: 600;
    text-decoration: none;
}

.tcg-state--showcase { color: #5c3a00; background: #fff1c7; }
.tcg-state--sale { color: rgb(var(--tcg-primary)); background: rgba(var(--tcg-primary), .12); }
.tcg-state--trade { color: #1d4f91; background: rgba(56, 132, 230, .14); }
a.tcg-state:hover { text-decoration: underline; }

.tcg-copy__actions { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .55rem; }
.tcg-copy__actions form { margin: 0; }
.tcg-copy .tcg-sell { margin: .6rem 0 0; }

.tcg-market-link {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .6rem .9rem;
    border-radius: .8rem;
    font-size: .9rem;
    font-weight: 600;
    text-decoration: none;
    color: #1d4f91;
    background: rgba(56, 132, 230, .08);
    border: 1px solid rgba(56, 132, 230, .25);
}

.tcg-market-link:hover { background: rgba(56, 132, 230, .14); }

/* ---- Échanges --------------------------------------------------------------- */
.tcg-notice--info {
    background: rgba(var(--tcg-primary), .07);
    border-color: rgba(var(--tcg-primary), .25);
}

.tcg-lot__note {
    margin-bottom: .5rem;
    padding: .4rem .6rem;
    border-radius: .5rem;
    font-size: .85rem;
    font-style: italic;
    color: rgba(0, 0, 0, .7);
    background: rgba(var(--tcg-primary), .06);
}

.tcg-deal {
    display: grid;
    grid-template-columns: auto auto 1fr minmax(12rem, 16rem);
    align-items: center;
    gap: 1rem;
    padding: 1rem 0;
    border-top: 1px solid rgba(var(--tcg-primary), .1);
}

.tcg-deal:first-of-type { border-top: 0; padding-top: 0; }
.tcg-deal__label { margin-bottom: .4rem; font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: rgba(0, 0, 0, .55); }
.tcg-deal__cards { display: flex; flex-wrap: wrap; gap: .6rem; }
.tcg-deal__swap { font-size: 1.3rem; color: rgb(var(--tcg-primary)); }

.tcg-deal__message {
    margin: 0 0 .4rem;
    padding: .4rem .7rem;
    border-left: 3px solid rgba(var(--tcg-primary), .4);
    font-size: .88rem;
    font-style: italic;
    color: rgba(0, 0, 0, .75);
}

@media (max-width: 991.98px) {
    .tcg-deal { grid-template-columns: auto auto 1fr; }
    .tcg-deal__actions { grid-column: 1 / -1; }
}

@media (max-width: 575.98px) {
    .tcg-deal { grid-template-columns: 1fr; justify-items: start; }
    .tcg-deal__swap { transform: rotate(90deg); }
}

/* Formulaire d'offre (modale). */
.tcg-deal-head { display: flex; gap: 1rem; align-items: center; }

.tcg-pick {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(8.5rem, 1fr));
    gap: .8rem;
    max-height: 22rem;
    padding: .3rem;
    overflow-y: auto;
}

.tcg-pick__item {
    position: relative;
    display: flex;
    justify-content: center;
    padding: .4rem;
    border-radius: .9rem;
    border: 2px solid transparent;
    cursor: pointer;
    transition: border-color .15s ease, background-color .15s ease;
}

.tcg-pick__item:hover { background: rgba(var(--tcg-primary), .06); }

/* La case reste dans l'ordre de tabulation et lue par les lecteurs d'écran ; elle est seulement
   rendue invisible, l'état passe par la bordure et la coche. */
.tcg-pick__input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.tcg-pick__item:has(.tcg-pick__input:focus-visible) { outline: 2px solid rgb(var(--tcg-primary)); outline-offset: 2px; }
.tcg-pick__item:has(.tcg-pick__input:checked) { border-color: rgb(var(--tcg-primary)); background: rgba(var(--tcg-primary), .1); }
.tcg-pick__item:has(.tcg-pick__input:disabled) { opacity: .45; cursor: not-allowed; }

.tcg-pick__check {
    position: absolute;
    top: .2rem;
    right: .2rem;
    z-index: 5;
    display: none;
    align-items: center;
    justify-content: center;
    width: 1.6rem;
    height: 1.6rem;
    border-radius: 50%;
    color: #fff;
    background: rgb(var(--tcg-primary));
    box-shadow: 0 .2em .5em rgba(0, 0, 0, .3);
}

.tcg-pick__item:has(.tcg-pick__input:checked) .tcg-pick__check { display: inline-flex; }

/* Dans la grille de choix, la carte n'est pas cliquable seule : c'est l'étiquette qui l'est. */
.tcg-pick .tcg-card { pointer-events: none; }

/* ---- Hôtel des ventes --------------------------------------------------- */
/* Hôtel des ventes et échanges : lots en colonne (carte au-dessus, infos dessous), pour en
   aligner quatre ou cinq par ligne au lieu de deux. */
.tcg-auctions {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(13.5rem, 1fr));
    gap: 1.2rem;
}

.tcg-lot {
    display: flex;
    flex-direction: column;
    gap: .9rem;
    align-items: stretch;
    padding: 1rem;
}
.tcg-lot > .tcg-card { align-self: center; }

.tcg-lot.is-leading { border-color: rgba(var(--tcg-uncommon), .6); }

/* Hôtel des ventes : une colonne de moins que la grille d'échanges (lots plus larges, plus de
   place pour le prix, le cours et les actions), et des infos rangées en blocs. */
.tcg-auctions--market { grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr)); gap: 1.4rem; }
.tcg-auctions--market .tcg-lot { padding: 1.1rem 1.2rem 1.2rem; gap: 1rem; }

.tcg-lot__head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: .35rem .6rem;
    margin-bottom: .6rem;
}
.tcg-lot__head .tcg-own { margin-bottom: 0; }
.tcg-lot__seller { font-size: .8rem; color: rgba(0, 0, 0, .55); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.tcg-lot__price {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: .75rem;
    padding-bottom: .55rem;
    border-bottom: 1px solid rgba(0, 0, 0, .07);
}
.tcg-lot__key {
    display: block;
    font-size: .68rem;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: rgba(0, 0, 0, .5);
}
.tcg-lot__amount { font-size: 1.45rem; font-weight: 700; line-height: 1.15; color: rgba(0, 0, 0, .88); white-space: nowrap; }
.tcg-lot__amount i { font-size: .7em; color: rgb(var(--tcg-legendary)); }
.tcg-lot__facts { margin: 0; padding: 0; list-style: none; text-align: right; font-size: .78rem; color: rgba(0, 0, 0, .65); }
.tcg-lot__facts li { display: flex; align-items: center; justify-content: flex-end; gap: .35rem; white-space: nowrap; }
.tcg-lot__facts i { width: 1em; text-align: center; color: rgba(0, 0, 0, .4); }

.tcg-auctions--market .tcg-cours { margin: .65rem 0 .75rem; }
.tcg-lot__info { flex: 1; min-width: 0; }

/* Possédée ou non : l'étiquette en tête d'un lot. Une carte qui manque est soulignée d'un liseré
   — c'est le lot qu'un collectionneur cherche des yeux. */
.tcg-lot.is-wanted { box-shadow: inset 3px 0 0 rgb(var(--tcg-secondary)); }

.tcg-own {
    display: inline-flex;
    align-items: center;
    gap: .35em;
    margin-bottom: .45rem;
    padding: .2em .65em;
    border-radius: 2em;
    font-size: .78rem;
    font-weight: 600;
    line-height: 1.4;
}

.tcg-own--have { color: rgb(var(--tcg-primary)); background: rgba(var(--tcg-primary), .1); }
.tcg-own--missing { color: rgb(120, 60, 20); background: rgba(var(--tcg-secondary), .18); }

/* ---------- Cartes désirées ---------- */
/* Pastille cœur, en haut à gauche ; sous la pastille « brillante » quand les deux sont là. */
.tcg-card__wish {
    position: absolute;
    z-index: 4;
    left: -.45em;
    top: -.45em;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1.9em;
    height: 1.9em;
    border-radius: 50%;
    font-size: .8em;
    color: #fff;
    background: #e0457b;
    box-shadow: 0 .2em .6em rgba(0, 0, 0, .3);
    pointer-events: none;
}
.tcg-card__foil-mark ~ .tcg-card__wish { top: 1.7em; }

/* Cœur de la fiche, en haut à droite de la grande carte : contour rose, plein une fois la carte
   désirée. */
.tcg-wish-wrap { position: relative; }
.tcg-wish-toggle { position: absolute; z-index: 6; top: -.7rem; right: -.7rem; margin: 0; }
.tcg-wish-toggle__btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.9rem;
    height: 2.9rem;
    padding: 0;
    border: 0;
    border-radius: 50%;
    font-size: 1.6rem;
    color: #e0457b;
    background: none;
    /* Ni cercle ni fond : le cœur seul, détaché de l'illustration par une ombre portée. */
    filter: drop-shadow(0 1px 1px rgba(0, 0, 0, .55)) drop-shadow(0 0 3px rgba(0, 0, 0, .35));
    cursor: pointer;
    transition: transform .15s ease, color .15s ease;
}
.tcg-wish-toggle__btn:hover { transform: scale(1.15); }
.tcg-wish-toggle__btn:focus-visible { outline: 3px solid rgba(224, 69, 123, .55); outline-offset: 1px; }
.tcg-wish-toggle__btn.is-on { color: #e0457b; }
.tcg-wish-toggle__btn:disabled { opacity: .6; cursor: wait; }

/* Cœur de la grille de collection, en haut à gauche de chaque carte. Non désirée : discret
   (contour, un peu transparent), net au survol de la carte ou au focus ; désirée : toujours plein.
   Sur écran tactile (pas de survol), il reste pleinement visible. */
.tcg-grid__item { position: relative; }
.tcg-grid__wish { position: absolute; z-index: 6; top: -.55rem; left: -.55rem; margin: 0; }
.tcg-wish-toggle__btn--sm { width: 2.2rem; height: 2.2rem; font-size: 1.25rem; }
.tcg-wish-toggle__btn--sm:not(.is-on) { opacity: .75; }
.tcg-grid__item:hover .tcg-wish-toggle__btn--sm,
.tcg-wish-toggle__btn--sm:focus-visible { opacity: 1; }
@media (hover: none) { .tcg-wish-toggle__btn--sm:not(.is-on) { opacity: 1; } }
/* La pastille « brillante » occupe aussi le coin haut gauche : elle passe juste en dessous du cœur. */
.tcg-grid__item .tcg-card__foil-mark { top: 1.9rem; }

/* « X désire » : sur une annonce d'échange et dans le formulaire d'offre. */
.tcg-wants { margin: .25rem 0 .5rem; }
.tcg-wants__label { display: block; font-size: .8rem; font-weight: 700; color: #c7346a; margin-bottom: .25rem; }
.tcg-wants__list { display: flex; flex-wrap: wrap; gap: .3rem; margin: 0; padding: 0; list-style: none; }
.tcg-wants__item {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: .15rem .55rem;
    border-radius: 2rem;
    font-size: .78rem;
    color: rgba(0, 0, 0, .75);
    background: rgba(0, 0, 0, .06);
}
.tcg-wants__item.is-have { color: rgb(var(--tcg-primary)); background: rgba(var(--tcg-primary), .12); font-weight: 600; }
.tcg-wants__more { color: rgba(0, 0, 0, .55); }

.tcg-pick__item.is-wanted { border-color: rgba(224, 69, 123, .55); }
.tcg-pick__wanted { font-size: .72rem; font-weight: 700; color: #c7346a; }

/* ---------- Cours des cartes (hôtel des ventes) ---------- */
/* Encart sous le prix d'un lot : libellé et écart en %, le cours, une jauge, la base du calcul.
   La teinte (--cours) dit si le lot est sous le cours (vert), au cours (neutre) ou au-dessus (orange). */
.tcg-cours {
    --cours: 100, 116, 139;
    margin: .35rem 0 .6rem;
    padding: .5rem .65rem .45rem;
    border-radius: .6rem;
    background: rgba(var(--cours), .07);
    border: 1px solid rgba(var(--cours), .18);
}
.tcg-cours--low { --cours: 22, 163, 74; }
.tcg-cours--high { --cours: 234, 88, 12; }
.tcg-cours--none { background: transparent; border-style: dashed; }

.tcg-cours__top { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.tcg-cours__label {
    font-size: .68rem;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: rgba(0, 0, 0, .5);
}
.tcg-cours__delta {
    display: inline-flex;
    align-items: center;
    gap: .3em;
    padding: .1rem .5rem;
    border-radius: 2rem;
    font-size: .72rem;
    font-weight: 700;
    white-space: nowrap;
    color: rgb(var(--cours));
    background: rgba(var(--cours), .14);
}
.tcg-cours--fair .tcg-cours__delta { color: rgba(0, 0, 0, .6); background: rgba(0, 0, 0, .06); }

.tcg-cours__value { font-size: 1rem; font-weight: 700; color: rgba(0, 0, 0, .85); line-height: 1.3; }
.tcg-cours__value i { font-size: .8em; color: rgb(var(--tcg-legendary)); }

/* Jauge : de -50 % (gauche) à +50 % (droite) autour du cours (trait central). */
.tcg-cours__gauge {
    position: relative;
    height: .3rem;
    margin: .35rem 0 .3rem;
    border-radius: 1rem;
    background: linear-gradient(90deg, rgba(22, 163, 74, .45), rgba(0, 0, 0, .1) 45% 55%, rgba(234, 88, 12, .45));
}
.tcg-cours__gauge::before {
    content: "";
    position: absolute;
    left: 50%;
    top: -.15rem;
    bottom: -.15rem;
    width: 2px;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, .35);
}
.tcg-cours__gauge span {
    position: absolute;
    top: 50%;
    width: .7rem;
    height: .7rem;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    background: #fff;
    border: 2px solid rgb(var(--cours));
    box-shadow: 0 1px 3px rgba(0, 0, 0, .25);
}
.tcg-cours--fair .tcg-cours__gauge span { border-color: rgba(0, 0, 0, .55); }

.tcg-cours__meta { font-size: .72rem; color: rgba(0, 0, 0, .5); }

/* Rappel du cours dans le formulaire de vente de la fiche. */
.tcg-cours-line { color: rgba(0, 0, 0, .7); }

/* Booster acheté : le paquet arrivé dans le stock sautille une fois, sans faire défiler la page. */
.tcg-pack.is-arrived { animation: tcg-pack-arrive .8s ease-in-out 1; }
@keyframes tcg-pack-arrive {
    0%, 100% { transform: rotate(0) translateY(0); }
    25% { transform: rotate(3deg) translateY(-8px); }
    50% { transform: rotate(-4deg) translateY(-8px); }
    75% { transform: rotate(2deg) translateY(0); }
}

.tcg-chip {
    display: inline-flex;
    align-items: center;
    gap: .45em;
    padding: .3em .4em .3em .8em;
    border-radius: 2em;
    font-size: .9rem;
    background: rgba(var(--tcg-primary), .1);
}

.tcg-chip__close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.6em;
    height: 1.6em;
    border-radius: 50%;
    color: inherit;
    text-decoration: none;
}

.tcg-chip__close:hover, .tcg-chip__close:focus-visible { background: rgba(var(--tcg-primary), .18); }

/* Lots d'une carte, dans sa fiche. */
.tcg-market {
    padding: .9rem 1rem;
    border-radius: .8rem;
    background: rgba(var(--tcg-primary), .05);
    border: 1px solid rgba(var(--tcg-primary), .12);
}

.tcg-market.is-wanted { background: rgba(var(--tcg-secondary), .08); border-color: rgba(var(--tcg-secondary), .35); }

.tcg-market__row {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: .45rem 0;
    border-bottom: 1px solid rgba(var(--tcg-primary), .1);
}

.tcg-market__row:last-child { border-bottom: 0; }

/* Pastille « en vente » d'une carte manquante : marteau et prix plancher, au pied de la carte. */
.tcg-card__sale {
    position: absolute;
    z-index: 4;
    left: 50%;
    bottom: -.6em;
    transform: translateX(-50%);
    display: inline-flex;
    align-items: center;
    gap: .35em;
    padding: .35em .7em;
    border-radius: 2em;
    font-size: .75em;
    font-weight: 700;
    line-height: 1;
    white-space: nowrap;
    pointer-events: none;
    color: rgb(var(--tcg-ink));
    background: rgb(var(--tcg-secondary));
    box-shadow: 0 .2em .6em rgba(0, 0, 0, .3);
}

.tcg-mini {
    display: flex;
    flex-direction: column;
    padding: .55rem 0;
    border-bottom: 1px solid rgba(var(--tcg-primary), .1);
}

.tcg-mini form { margin: 0; }

/* ---- Historique des transactions (hôtel des ventes, échanges) ------------ */
/* Le tableau hérite du panneau : pas de fond blanc imposé, lisible dans les deux thèmes. */
.tcg-history {
    --bs-table-bg: transparent;
    --bs-table-color: inherit;
    background: transparent;
    color: inherit;
}
.tcg-history > :not(caption) > * > * {
    background: transparent;
    color: inherit;
    border-bottom-color: rgba(var(--tcg-primary), .12);
    padding: .6rem .5rem;
}
.tcg-history thead th {
    font-size: .75rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    opacity: .7;
    font-weight: 600;
}
.tcg-history__kind {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    font-weight: 600;
}
.tcg-history__kind--in > i { color: var(--bs-success, #198754); }
.tcg-history__kind--out > i { color: var(--bs-danger, #dc3545); }
.tcg-history__cards {
    list-style: none;
    margin: 0;
    padding: 0;
}
.tcg-history__cards li + li { margin-top: .2rem; }
.tcg-history__cards li > i { width: 1em; font-size: .75em; }

/* ---- Pastille de solde (bas gauche), sur le modèle de /boutique ---------- */
.tcg-wallet {
    position: fixed;
    left: 1rem;
    bottom: 1rem;
    z-index: 1030;
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    gap: .9rem;
    max-width: calc(100vw - 2rem);
    padding: .6rem 1.1rem .6rem .9rem;
    border-radius: 2rem;
    line-height: 1.1;
    background: rgba(255, 255, 255, .92);
    border: 1px solid rgba(var(--bs-warning-rgb, 251, 191, 36), .5);
    box-shadow: 0 .5rem 1.4rem rgba(42, 42, 42, .18);
    backdrop-filter: blur(6px);
}

.tcg-wallet__purse { position: relative; display: inline-flex; align-items: center; gap: .65rem; }

.tcg-wallet__sep { width: 1px; align-self: stretch; background: rgba(42, 42, 42, .15); }

.tcg-wallet__icon { font-size: 1.35rem; }
.tcg-wallet__icon--coin { color: rgb(var(--bs-warning-rgb, 251, 191, 36)); }
.tcg-wallet__icon--dust { color: rgb(var(--tcg-primary)); }

.tcg-wallet__amount {
    font-size: 1.15rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: rgba(42, 42, 42, .95);
}

.tcg-wallet__unit {
    font-size: .7rem;
    white-space: nowrap;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: rgba(42, 42, 42, .6);
}

/* Le montant gagné ou dépensé s'envole au-dessus de la bourse. */
.tcg-wallet__delta {
    position: absolute;
    left: 50%;
    top: -.25rem;
    transform: translateX(-50%);
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    pointer-events: none;
    animation: tcg-delta 1.6s ease-out forwards;
}

.tcg-wallet__delta.is-debit { color: rgb(var(--bs-danger-rgb, 220, 53, 69)); }
.tcg-wallet__delta.is-credit { color: rgb(var(--bs-success-rgb, 25, 135, 84)); }

@keyframes tcg-delta {
    from { opacity: 1; transform: translate(-50%, 0); }
    to { opacity: 0; transform: translate(-50%, -2.2rem); }
}

/* La scène d'ouverture passe par-dessus : la pastille ne doit pas cacher les boutons du bas. */
body.overflow-hidden .tcg-wallet { display: none; }

/* ==========================================================================
   Scène d'ouverture
   ========================================================================== */

.tcg-opening {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    color: rgb(var(--tcg-ink));
    overflow: hidden;
}

.tcg-opening[hidden] { display: none; }

.tcg-opening__backdrop {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(60% 50% at 50% 45%, rgba(var(--theme-a, 124, 58, 237), .35), transparent 70%),
        rgba(var(--tcg-night), .94);
    backdrop-filter: blur(6px);
    animation: tcg-fade-in .3s ease both;
}

.tcg-opening__rays {
    position: absolute;
    left: 50%;
    top: 45%;
    width: 160vmax;
    height: 160vmax;
    transform: translate(-50%, -50%);
    /* Les rayons s'éteignent vers les bords : quelle que soit la taille de l'écran, on n'en voit
       jamais l'extrémité. */
    -webkit-mask-image: radial-gradient(circle, #000 14%, transparent 44%);
    mask-image: radial-gradient(circle, #000 14%, transparent 44%);
    opacity: 0;
    transition: opacity .8s ease;
    pointer-events: none;
}

/* Le centrage reste sur l'élément, la rotation et la pulsation vivent sur le pseudo-élément :
   une animation de `transform` sur l'élément lui-même écraserait son `translate(-50%, -50%)`, et
   le fond dériverait hors de l'écran. Deux animations, deux propriétés : rien ne se marche dessus. */
.tcg-opening__rays::before {
    content: "";
    position: absolute;
    inset: 0;
    background: repeating-conic-gradient(from 0deg, rgba(var(--tcg-ink), .09) 0deg 5deg, transparent 5deg 15deg);
    animation: tcg-spin 70s linear infinite, tcg-rays-pulse 2.8s ease-in-out infinite;
}

@keyframes tcg-rays-pulse {
    0%, 100% { opacity: .45; }
    50% { opacity: 1; }
}

.tcg-opening.is-open .tcg-opening__rays { opacity: 1; }

.tcg-opening__top,
.tcg-opening__bar {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.5rem;
}

.tcg-opening__bar { flex-direction: column; justify-content: center; padding-bottom: 1.8rem; }

.tcg-opening__title { margin: 0; font-size: 1.4rem; }

.tcg-opening__icon-btn {
    width: 2.6rem;
    height: 2.6rem;
    border: 1px solid rgba(var(--tcg-ink), .25);
    border-radius: 50%;
    color: rgb(var(--tcg-ink));
    background: rgba(var(--tcg-ink), .08);
}

.tcg-opening__icon-btn:hover { background: rgba(var(--tcg-ink), .18); }

.tcg-opening__stage {
    position: relative;
    z-index: 1;
    flex: 1;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    min-height: 0;
    padding: 1rem;
    overflow-y: auto;
    overscroll-behavior: contain;
}

/* `margin: auto` centre tant que le contenu tient, et le laisse défiler depuis le haut quand il
   déborde — là où `align-items: center` coupait le haut, hors d'atteinte du défilement. */
.tcg-opening__stage > * { margin: auto; }

.tcg-opening__pack {
    position: absolute;
    inset: 0;
    width: fit-content;
    height: fit-content;
    margin: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.2rem;
}

.tcg-opening__hint { margin: 0; font-size: .95rem; opacity: .8; letter-spacing: .04em; }

.tcg-opening__summary { min-height: 1.5rem; text-align: center; font-weight: 600; }

/* ---- Le grand paquet ---------------------------------------------------- */
.tcg-bigpack {
    position: relative;
    width: min(15rem, 52vw);
    aspect-ratio: 63 / 100;
    filter: drop-shadow(0 1.5rem 2.5rem rgba(0, 0, 0, .55));
}

.tcg-bigpack__half {
    position: absolute;
    left: 0;
    right: 0;
    overflow: hidden;
    background:
        repeating-linear-gradient(45deg, rgba(var(--tcg-ink), .06) 0 8px, transparent 8px 16px),
        linear-gradient(165deg, rgb(var(--theme-a, 124, 58, 237)), rgb(var(--theme-b, 30, 22, 70)));
    box-shadow: inset 0 0 0 3px rgba(var(--tcg-ink), .2);
    transition: transform .6s cubic-bezier(.2, .8, .2, 1), opacity .6s ease;
}

.tcg-bigpack__half--top {
    top: 0;
    height: 15%;
    border-radius: 1rem 1rem 0 0;
    background-position: 0 0;
}

.tcg-bigpack__half--body {
    top: 15%;
    bottom: 0;
    border-radius: 0 0 1.1rem 1.1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    border-top: 3px dashed rgba(var(--tcg-ink), .45);
}

.tcg-bigpack__seal {
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(90deg, rgba(var(--tcg-ink), .4) 0 5px, rgba(var(--tcg-ink), .12) 5px 10px);
}

.tcg-bigpack__crest { font-size: 4.5rem; filter: drop-shadow(0 0 1.2rem rgba(var(--tcg-ink), .45)); }

.tcg-bigpack__name {
    padding: 0 1rem;
    font-family: "Marcellus", Georgia, serif;
    font-size: 1.3rem;
    font-weight: 700;
    text-align: center;
    text-shadow: 0 2px 6px rgba(0, 0, 0, .6);
}

.tcg-bigpack__light {
    position: absolute;
    left: 50%;
    top: 15%;
    width: 10%;
    height: 4%;
    transform: translate(-50%, -50%) scale(0);
    border-radius: 50%;
    background: radial-gradient(circle, rgba(var(--tcg-ink), 1), rgba(var(--tcg-legendary), .7) 40%, transparent 70%);
    opacity: 0;
    pointer-events: none;
}

.tcg-opening__pack.is-entering .tcg-bigpack { animation: tcg-pack-in .7s cubic-bezier(.2, .9, .3, 1.2) both; }
.tcg-opening__pack.is-shaking .tcg-bigpack { animation: tcg-shake .5s ease-in-out infinite; }

.tcg-opening__pack.is-tearing .tcg-bigpack__half--top { transform: translate(40%, -180%) rotate(28deg); opacity: 0; }
.tcg-opening__pack.is-tearing .tcg-bigpack__half--body { transform: translateY(35%) scale(.92); opacity: 0; transition-delay: .35s; }
.tcg-opening__pack.is-tearing .tcg-bigpack__light { animation: tcg-burst .9s ease-out .1s both; }
.tcg-opening__pack.is-tearing .tcg-opening__hint { opacity: 0; }
.tcg-opening__pack.is-gone { visibility: hidden; }

@keyframes tcg-pack-in {
    from { transform: translateY(30vh) scale(.6) rotate(-12deg); opacity: 0; }
    to { transform: none; opacity: 1; }
}

@keyframes tcg-shake {
    0%, 100% { transform: rotate(0); }
    25% { transform: rotate(-3deg) translateX(-3px); }
    75% { transform: rotate(3deg) translateX(3px); }
}

@keyframes tcg-burst {
    0% { transform: translate(-50%, -50%) scale(0); opacity: 1; }
    60% { opacity: 1; }
    100% { transform: translate(-50%, -50%) scale(30); opacity: 0; }
}

@keyframes tcg-fade-in { from { opacity: 0; } }

/* ---- La pile ------------------------------------------------------------
   Les cartes sortent du paquet en une pile, face cachée. On les découvre une à une :
   1er clic, la carte du dessus se retourne ; 2e clic, elle file sous la pile et la suivante
   apparaît. Après la dernière, la pile s'étale en récapitulatif.

   Chaque carte porte `--depth` (0 = dessus) posé par le script ; tout le reste est ici. */
.tcg-opening__cards {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    /* Une carte fait 15,5 em de large et ~21,6 em de haut. On prend la plus grande taille qui
       tient à la fois dans la largeur et dans la hauteur laissée par l'en-tête, la légende et la
       barre du bas (~19 rem). */
    font-size: clamp(10px, min((100vw - 3rem) / 16.5, (100dvh - 19rem) / 23), 20px);
}

.tcg-pile {
    position: relative;
    width: 15.5em;
    aspect-ratio: 63 / 88;
}

/* Halo derrière la pile, teinté par la rareté de la carte du dessus. */
.tcg-pile::before {
    content: "";
    position: absolute;
    inset: -45%;
    z-index: 0;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(var(--halo, var(--tcg-ink)), .35), transparent 62%);
    opacity: .5;
    transition: background .6s ease, opacity .6s ease;
    pointer-events: none;
}

.tcg-pile[data-top-tier="rare"]::before { --halo: var(--tcg-rare); opacity: .7; }
.tcg-pile[data-top-tier="epic"]::before { --halo: var(--tcg-epic); opacity: .9; }
.tcg-pile[data-top-tier="legendary"]::before { --halo: var(--tcg-legendary); opacity: 1; animation: tcg-halo 1.4s ease-in-out infinite; }
.tcg-pile[data-top-tier="mythic"]::before { --halo: var(--tcg-mythic); opacity: 1; animation: tcg-halo 1s ease-in-out infinite; }

@keyframes tcg-halo { 50% { transform: scale(1.12); } }

.tcg-flip {
    --depth: 0;
    --tilt: 0deg;
    position: absolute;
    inset: 0;
    z-index: calc(50 - var(--depth));
    width: 100%;
    padding: 0;
    border: 0;
    background: none;
    color: inherit;
    cursor: pointer;
    perspective: 1400px;
    transform:
        translate(calc(var(--depth) * 5px), calc(var(--depth) * -5px))
        rotate(calc(var(--tilt) * min(var(--depth), 1)));
    transition: transform .45s cubic-bezier(.2, .8, .2, 1), opacity .3s ease;
}

/* Arrivée : les cartes jaillissent du paquet et se posent l'une sur l'autre. */
.tcg-flip.is-dealing { animation: tcg-deal .55s cubic-bezier(.2, .9, .3, 1.15) both; animation-delay: calc(var(--i) * 90ms); }

@keyframes tcg-deal {
    from { transform: translateY(32vh) scale(.55) rotate(calc(var(--i) * 7deg - 14deg)); opacity: 0; }
    to { opacity: 1; }
}

/* La carte du dessus respire, pour inviter au clic. */
.tcg-flip.is-top:not(.is-revealed) { animation: tcg-breathe 2.2s ease-in-out infinite; }

@keyframes tcg-breathe {
    0%, 100% { transform: translateY(0) scale(1); }
    50% { transform: translateY(-.35em) scale(1.015); }
}

/* Révélée : la carte grandit un peu, pour qu'on la lise. */
.tcg-flip.is-top.is-revealed { transform: scale(1.06); }

/* Envoi sous la pile, en deux temps : elle s'écarte, puis le script la renumérote dessous. */
.tcg-flip.is-tucking {
    transform: translateX(78%) rotate(14deg) scale(.92);
    transition: transform .32s cubic-bezier(.4, 0, .6, 1);
}

.tcg-flip__inner {
    position: absolute;
    inset: 0;
    transform-style: preserve-3d;
    transition: transform .75s cubic-bezier(.3, 1.35, .4, 1);
}

.tcg-flip.is-revealed .tcg-flip__inner { transform: rotateY(180deg); }

.tcg-flip__face {
    position: absolute;
    inset: 0;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

.tcg-flip__face--front { transform: rotateY(180deg); }
.tcg-flip__face--front .tcg-card { width: 100%; font-size: inherit; }

.tcg-flip__face--back {
    border-radius: .9em;
    display: flex;
    align-items: center;
    justify-content: center;
    background:
        radial-gradient(circle at 50% 50%, rgba(var(--tcg-ink), .18), transparent 45%),
        repeating-linear-gradient(45deg, rgba(var(--tcg-ink), .05) 0 6px, transparent 6px 12px),
        linear-gradient(160deg, rgb(var(--theme-a, 124, 58, 237)), rgb(var(--theme-b, 30, 22, 70)));
    box-shadow: 0 .7em 1.6em rgba(0, 0, 0, .45), inset 0 0 0 .4em rgba(var(--tcg-ink), .12), inset 0 0 0 .55em rgba(var(--tcg-legendary), .5);
}

.tcg-flip__face--back i { font-size: 4.5em; color: rgba(var(--tcg-legendary), .85); filter: drop-shadow(0 0 .6em rgba(var(--tcg-legendary), .6)); }

/* L'aura du dos annonce la rareté avant le retournement. */
.tcg-flip--rare .tcg-flip__face--back { box-shadow: 0 0 1.4em rgba(var(--tcg-rare), .7), inset 0 0 0 .4em rgba(var(--tcg-ink), .12); }
.tcg-flip--epic.is-top .tcg-flip__face--back { animation: tcg-aura-epic 1.4s ease-in-out infinite; }
.tcg-flip--legendary.is-top .tcg-flip__face--back { animation: tcg-aura-legendary 1.1s ease-in-out infinite; }
.tcg-flip--mythic.is-top .tcg-flip__face--back { animation: tcg-aura-mythic 1.6s linear infinite; }

@keyframes tcg-aura-epic {
    0%, 100% { box-shadow: 0 0 1.2em rgba(var(--tcg-epic), .5); }
    50% { box-shadow: 0 0 2.6em rgba(var(--tcg-epic), .95); }
}

@keyframes tcg-aura-legendary {
    0%, 100% { box-shadow: 0 0 1.6em rgba(var(--tcg-legendary), .6); }
    50% { box-shadow: 0 0 3.6em rgba(var(--tcg-legendary), 1); }
}

@keyframes tcg-aura-mythic {
    0% { box-shadow: 0 0 2.6em rgba(255, 79, 163, .95); }
    33% { box-shadow: 0 0 2.6em rgba(79, 195, 255, .95); }
    66% { box-shadow: 0 0 2.6em rgba(255, 216, 79, .95); }
    100% { box-shadow: 0 0 2.6em rgba(255, 79, 163, .95); }
}

/* Légende de la carte du dessus, sous la pile. */
.tcg-opening__caption {
    min-height: 3.2rem;
    margin-top: 2.2rem;
    text-align: center;
}

.tcg-opening__caption-rarity {
    display: block;
    font-size: .8rem;
    letter-spacing: .16em;
    text-transform: uppercase;
    opacity: .75;
}

.tcg-opening__caption-name { display: block; font-family: "Marcellus", Georgia, serif; font-size: 1.5rem; }
.tcg-opening__caption .is-new { color: rgb(var(--tcg-legendary)); font-weight: 700; }

.tcg-opening__counter { font-size: .9rem; opacity: .7; letter-spacing: .08em; }

/* ---- Récapitulatif : la pile s'étale ------------------------------------ */
.tcg-recap {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1.2rem;
    max-width: 1200px;
    font-size: clamp(9px, 1.05vw, 14px);
}

@media (max-width: 575.98px) {
    .tcg-recap {
        display: grid;
        grid-template-columns: repeat(2, auto);
        justify-content: center;
        gap: .9rem .7rem;
        /* Deux cartes et leur écart dans la largeur de l'écran. */
        font-size: min(11px, (100vw - 3rem) / 31.5);
    }

    .tcg-opening__top { padding: .8rem 1rem; }
    .tcg-opening__title { font-size: 1.15rem; }
    .tcg-opening__bar { padding: .6rem 1rem 1.2rem; gap: .6rem; }
    .tcg-opening__summary { font-size: .9rem; }
    .tcg-opening__caption { margin-top: 1.4rem; }
    .tcg-opening__caption-name { font-size: 1.25rem; }
}

/* La carte prend la taille calculée par le récapitulatif, pas ses 14 px par défaut. */
.tcg-recap .tcg-card { font-size: inherit; }

/* Nombre impair sur deux colonnes : la dernière carte se centre au lieu de rester à gauche. */
.tcg-recap__item:last-child:nth-child(odd) { grid-column: 1 / -1; justify-self: center; }

.tcg-recap__item {
    --i: 0;
    animation: tcg-spread .5s cubic-bezier(.2, .9, .3, 1.15) both;
    animation-delay: calc(var(--i) * 70ms);
}

@keyframes tcg-spread {
    from { transform: scale(.6) translateY(4rem); opacity: 0; }
    to { transform: none; opacity: 1; }
}

.tcg-recap__label {
    display: block;
    margin-top: .5rem;
    font-size: 1.05em;
    font-weight: 700;
    text-align: center;
}

.tcg-flip:focus { outline: none; }
/* Pas de contour de focus sur la pile : la carte du dessus est déjà l'unique cible, mise en avant. */

/* ---- Effets des grandes raretés ---------------------------------------- */
.tcg-opening__fx { position: absolute; inset: 0; z-index: 3; pointer-events: none; overflow: hidden; }

.tcg-particle {
    position: absolute;
    width: .55rem;
    height: .55rem;
    border-radius: 50%;
    background: rgb(var(--p, var(--tcg-legendary)));
    box-shadow: 0 0 .6rem rgb(var(--p, var(--tcg-legendary)));
    animation: tcg-particle 1.1s cubic-bezier(.15, .7, .3, 1) forwards;
}

@keyframes tcg-particle {
    from { transform: translate(-50%, -50%) scale(1); opacity: 1; }
    to { transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(.2); opacity: 0; }
}

.tcg-opening::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 4;
    pointer-events: none;
    opacity: 0;
    background: radial-gradient(circle at 50% 50%, rgba(var(--flash, var(--tcg-legendary)), .55), transparent 65%);
}

.tcg-opening.is-flash::after { animation: tcg-flash .9s ease-out; }
.tcg-opening.is-quake .tcg-opening__stage { animation: tcg-quake .45s linear; }

@keyframes tcg-flash { 0% { opacity: 1; } 100% { opacity: 0; } }

@keyframes tcg-quake {
    0%, 100% { transform: none; }
    20% { transform: translate(-6px, 3px); }
    40% { transform: translate(5px, -4px); }
    60% { transform: translate(-4px, -2px); }
    80% { transform: translate(3px, 4px); }
}

/* Petit écran : les cartes se rangent en deux colonnes et la scène défile. */
@media (max-width: 575.98px) {
    .tcg-grid { font-size: 11px; gap: 1.4rem .8rem; grid-template-columns: repeat(auto-fill, minmax(14em, 1fr)); }
}

/* Mouvement réduit : tout reste, rien ne bouge. */
@media (prefers-reduced-motion: reduce) {
    .tcg-card *, .tcg-card__inner, .tcg-card__inner::before, .tcg-card__frame::after, .tcg-flip, .tcg-flip__inner, .tcg-flip__face--back,
    .tcg-opening *, .tcg-daily__pack .tcg-pack, .tcg-glow, .tcg-opening__rays {
        animation: none !important;
        transition: none !important;
    }
}

/* ==========================================================================
   Vue 3D plein écran (fiche de carte → clic sur la carte)
   La carte est un clone du gabarit `_card.html.twig` : même rendu, posé sur une
   face avant, un dos et une tranche faite de fines couches empilées.
   ========================================================================== */
.tcg-3d-trigger {
    cursor: zoom-in;
    border-radius: 1rem;
    outline-offset: .35rem;
}
.tcg-3d-trigger:focus-visible { outline: 3px solid rgb(var(--tcg-primary)); }

.tcg-viewer {
    /* Taille de la carte : 80 % de la hauteur ou 85 % de la largeur, le plus petit des deux. */
    --tcg-viewer-size: min(3.7vh, 5.4vw);
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background:
        radial-gradient(60% 55% at 50% 45%, rgba(var(--tcg-primary), .35), transparent 70%),
        radial-gradient(circle at 50% 120%, rgba(0, 0, 0, .6), transparent 60%),
        #0b0a12;
    color: #fff;
    animation: tcg-viewer-in .25s ease;
}
.tcg-viewer.is-closing { animation: tcg-viewer-out .2s ease forwards; }
@keyframes tcg-viewer-in { from { opacity: 0; } }
@keyframes tcg-viewer-out { to { opacity: 0; } }

.tcg-viewer__stage {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    perspective: 1400px;
    touch-action: none;
    cursor: grab;
    user-select: none;
    -webkit-user-select: none;
}
.tcg-viewer__stage.is-dragging { cursor: grabbing; }

.tcg-viewer__card {
    position: relative;
    font-size: var(--tcg-viewer-size);
    width: 15.5em;
    aspect-ratio: 63 / 88;
    transform-style: preserve-3d;
    will-change: transform;
}

/* Faces : le clone de carte (avant) et le dos, dos à dos. */
.tcg-viewer__face {
    position: absolute;
    inset: 0;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}
.tcg-viewer__face--front { transform: translateZ(.09em); }
.tcg-viewer__face--back { transform: rotateY(180deg) translateZ(.09em); }

.tcg-viewer .tcg-card {
    width: 100%;
    font-size: 1em;
    perspective: none;
    pointer-events: none;
}
.tcg-viewer .tcg-card__inner {
    transform: none;
    transition: none;
    box-shadow: none;
}
/* Pastilles de collection (×3, en vente, Nouveau) : utiles en liste, du bruit en vitrine. */
.tcg-viewer .tcg-card__count,
.tcg-viewer .tcg-card__sale,
.tcg-viewer .tcg-card__ribbon { display: none; }
.tcg-viewer .tcg-card.is-foil .tcg-card__shine { animation: none; }
.tcg-viewer .tcg-card__glare { opacity: 1; transition: none; }

/* Dos : le motif des boîtes de booster, à la couleur du deck, cerclé de la rareté. */
/* Même liseré que la face avant (.tcg-card__frame : retrait .42em, filet de 1px) : les anneaux
   intérieurs du dos des boîtes, en rem, s'ajoutaient à la bordure et la doublaient presque. */
.tcg-viewer__back .tcg-back {
    position: absolute;
    inset: .42em;
    width: auto;
    /* Le dos des boîtes fixe ses proportions (63 / 88) : ici, c'est la carte qui les donne. Sans
       ça, à l'export d'un format plus allongé (747 × 1122), le dos s'arrêtait avant le bas. */
    aspect-ratio: auto;
    flex-direction: column;
    gap: 1.6em;
    border-radius: .62em;
    border: 1px solid rgba(var(--tcg-ink), .14);
    box-shadow: none;
    /* Taille de la carte, pas plus : le retrait et l'arrondi ci-dessus sont en em. À 4em, ils
       étaient multipliés d'autant et la bordure du dos faisait quatre fois celle de la face. */
    font-size: 1em;
}
.tcg-viewer__back .tcg-back > i { font-size: 4em; }
.tcg-viewer__logo {
    width: 9.6em;
    max-width: 70%;
    height: auto;
    filter: drop-shadow(0 .2em .5em rgba(0, 0, 0, .45));
}
.tcg-viewer__back .tcg-back small {
    font-size: .64em;
    letter-spacing: .3em;
    text-transform: uppercase;
    font-weight: 700;
}

/* Tranche : quelques couches à la couleur de rareté, visibles quand la carte est de profil. */
.tcg-viewer__slice {
    position: absolute;
    inset: 0;
    border-radius: .9em;
    background: rgb(var(--tier));
    filter: brightness(.55);
}

/* Ombre au sol : suit le zoom, pas la rotation. */
.tcg-viewer__shadow {
    position: absolute;
    left: 50%;
    top: calc(50% + 12em * var(--tcg-viewer-zoom, 1));
    font-size: var(--tcg-viewer-size);
    width: 13em;
    height: 1.6em;
    transform: translateX(-50%) scale(var(--tcg-viewer-zoom, 1));
    border-radius: 50%;
    background: radial-gradient(closest-side, rgba(0, 0, 0, .55), transparent);
    pointer-events: none;
}

.tcg-viewer__tools {
    position: absolute;
    top: max(1rem, env(safe-area-inset-top));
    right: 1rem;
    z-index: 2;
    display: flex;
    gap: .5rem;
}
.tcg-viewer__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.75rem;
    height: 2.75rem;
    border: 1px solid rgba(255, 255, 255, .25);
    border-radius: 50%;
    background: rgba(255, 255, 255, .1);
    color: #fff;
    font-size: 1.05rem;
    backdrop-filter: blur(6px);
    transition: background .15s ease;
}
.tcg-viewer__btn:hover,
.tcg-viewer__btn[aria-pressed="true"] { background: rgba(255, 255, 255, .25); }
.tcg-viewer__btn:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

.tcg-viewer__title {
    position: absolute;
    top: max(1.2rem, env(safe-area-inset-top));
    left: 1rem;
    right: 12rem;
    z-index: 2;
    margin: 0;
    font-size: 1.1rem;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.tcg-viewer__hint {
    position: absolute;
    bottom: max(1rem, env(safe-area-inset-bottom));
    left: 50%;
    z-index: 2;
    transform: translateX(-50%);
    margin: 0;
    padding: .4rem .9rem;
    border-radius: 2rem;
    background: rgba(0, 0, 0, .45);
    font-size: .8rem;
    color: rgba(255, 255, 255, .8);
    text-align: center;
    white-space: nowrap;
    pointer-events: none;
    transition: opacity .6s ease;
}
.tcg-viewer__hint.is-faded { opacity: 0; }
@media (max-width: 575.98px) {
    .tcg-viewer__hint { white-space: normal; width: calc(100% - 2rem); }
}

/* ==========================================================================
   Boutons d'outils (barre de la collection, collection d'un membre)
   Dans l'esprit du sélecteur de deck voisin : fond clair, relief léger, pastille d'icône teintée.
   ========================================================================== */
.tcg-tool {
    --tool: var(--tcg-primary);
    display: inline-flex;
    align-items: center;
    gap: .6rem;
    min-height: 2.6rem;
    padding: .3rem .95rem .3rem .3rem;
    border: 1px solid rgba(var(--tool), .2);
    border-radius: 999px;
    background: #fff;
    color: #212529;
    font-weight: 600;
    font-size: .92rem;
    line-height: 1.2;
    text-decoration: none;
    box-shadow: 0 1px 2px rgba(0, 0, 0, .06), 0 2px 8px rgba(var(--tool), .08);
    transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.tcg-tool:hover,
.tcg-tool:focus-visible {
    color: #212529;
    border-color: rgba(var(--tool), .55);
    box-shadow: 0 2px 4px rgba(0, 0, 0, .06), 0 6px 16px rgba(var(--tool), .18);
    transform: translateY(-1px);
}
.tcg-tool:focus-visible { outline: 2px solid rgb(var(--tool)); outline-offset: 2px; }
.tcg-tool__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    background: rgba(var(--tool), .12);
    color: rgb(var(--tool));
    font-size: .9rem;
    transition: background .15s ease, color .15s ease;
}
.tcg-tool:hover .tcg-tool__icon { background: rgb(var(--tool)); color: #fff; }
.tcg-tool--gold { --tool: 180, 120, 10; }
.tcg-tool--dust { --tool: 109, 40, 217; }
@media (prefers-reduced-motion: reduce) { .tcg-tool:hover { transform: none; } }

/* ==========================================================================
   Modale « Recycler les doublons » : la forge
   Habillage propre à cette modale (`.tcg-modal.is-forge`, posé par cards-game.js), dans la
   charte du site : fond crème, olive (--tcg-primary), titres en Marcellus, formes en pilule
   comme les onglets du jeu. Les couleurs de rareté donnent le relief : liserés et halos.
   ========================================================================== */
.tcg-modal.is-forge {
    --forge-bg: 248, 247, 244;
    --forge-ink: 29, 30, 32;
}
.tcg-modal.is-forge .modal-dialog { max-width: 860px; }
.tcg-modal.is-forge .modal-content {
    background:
        radial-gradient(70% 45% at 50% 0%, rgba(var(--tcg-primary), .10), transparent 70%),
        radial-gradient(50% 35% at 100% 100%, rgba(var(--tcg-secondary, 200, 121, 65), .07), transparent 70%),
        rgb(var(--forge-bg)) !important;
    overflow: hidden;
}
.tcg-modal.is-forge .modal-header { padding: 1.2rem 1.4rem .3rem; }
.tcg-modal.is-forge .modal-title {
    font-family: Marcellus, serif;
    font-size: 1.5rem;
    font-weight: 400;
    color: #2a2a2a;
}
.tcg-modal.is-forge .modal-body { padding: .5rem 1.4rem 0; }

.tcg-forge { display: flex; flex-direction: column; }

/* Couleur de rareté lisible comme texte sur fond clair (l'ambre légendaire seul ne l'est pas). */
.tcg-forge__group,
.tcg-forge__cell { --tier-ink: color-mix(in srgb, rgb(var(--tier)) 62%, #1d1e20); }

/* ---- Barre d'outils ---------------------------------------------------- */
.tcg-forge__bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .6rem 1.2rem;
    padding-bottom: 1rem;
}
.tcg-forge__hint {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    margin: 0 auto 0 0;
    font-size: .88rem;
    color: rgba(var(--forge-ink), .6);
}
.tcg-forge__hint i { color: rgb(var(--tcg-primary)); }

.tcg-forge__switch {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    margin: 0;
    font-size: .85rem;
    color: rgba(var(--forge-ink), .8);
    cursor: pointer;
    user-select: none;
}
.tcg-forge__switch input { position: absolute; opacity: 0; pointer-events: none; }
.tcg-forge__switch-track {
    position: relative;
    width: 2.1rem;
    height: 1.2rem;
    border-radius: 1rem;
    background: rgba(var(--forge-ink), .15);
    transition: background .2s ease;
}
.tcg-forge__switch-track::after {
    content: "";
    position: absolute;
    top: .15rem;
    left: .15rem;
    width: .9rem;
    height: .9rem;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .25);
    transition: transform .2s ease;
}
.tcg-forge__switch input:checked + .tcg-forge__switch-track { background: rgb(var(--tcg-primary)); }
.tcg-forge__switch input:checked + .tcg-forge__switch-track::after { transform: translateX(.9rem); }
.tcg-forge__switch input:focus-visible + .tcg-forge__switch-track { outline: 2px solid rgb(var(--tcg-primary)); outline-offset: 2px; }
.tcg-forge__switch i { color: #c99312; }

/* Tout / Rien : le même rail que les onglets du jeu. */
.tcg-forge__seg {
    display: inline-flex;
    padding: 3px;
    border-radius: 800px;
    background: rgba(var(--tcg-primary), .08);
}
.tcg-forge__seg button {
    border: 0;
    padding: .3rem .9rem;
    border-radius: 800px;
    background: transparent;
    color: rgba(var(--forge-ink), .8);
    font-size: .82rem;
    font-weight: 700;
    transition: background .15s ease, color .15s ease;
}
.tcg-forge__seg button:hover { background: rgb(var(--tcg-primary)); color: #fff; }
.tcg-forge__seg button:focus-visible { outline: 2px solid rgb(var(--tcg-primary)); outline-offset: 1px; }

/* ---- Liste ------------------------------------------------------------- */
.tcg-forge__list {
    max-height: min(56vh, 36rem);
    overflow-y: auto;
    margin: 0 -1.4rem;
    padding: .35rem 1.4rem 1.1rem;
    scrollbar-width: thin;
    scrollbar-color: rgba(var(--tcg-primary), .35) transparent;
    -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 .6rem, #000 calc(100% - 1.1rem), transparent 100%);
    mask-image: linear-gradient(to bottom, transparent 0, #000 .6rem, #000 calc(100% - 1.1rem), transparent 100%);
}

.tcg-forge__group { margin: 0 0 1.5rem; padding: 0; border: 0; min-width: 0; }
.tcg-forge__group.is-kept .tcg-forge__legend { opacity: .5; }

/* En-tête de rareté : gemme, nom, filet dégradé à sa couleur. */
.tcg-forge__legend {
    float: none;
    width: 100%;
    display: flex;
    align-items: center;
    gap: .7rem;
    margin: 0 0 .8rem;
    padding: 0 0 .5rem;
    font-size: 1rem;
    border-bottom: 2px solid transparent;
    border-image: linear-gradient(90deg, rgb(var(--tier)), rgba(var(--tier), .2) 55%, transparent) 1;
    transition: opacity .2s ease;
}
.tcg-forge__legend-label { display: flex; align-items: center; gap: .6rem; flex: 1 1 auto; margin: 0; cursor: pointer; }
.tcg-forge__gem {
    width: .7rem;
    height: .7rem;
    transform: rotate(45deg);
    border-radius: 2px;
    background: linear-gradient(135deg, #fff, rgb(var(--tier)) 50%);
    box-shadow: 0 0 0 1px rgba(var(--tier), .5), 0 0 8px rgba(var(--tier), .55);
}
.tcg-forge__tier {
    font-family: Marcellus, serif;
    font-size: 1.15rem;
    color: var(--tier-ink);
}
.tcg-forge__legend-meta { font-size: .8rem; color: rgba(var(--forge-ink), .5); font-variant-numeric: tabular-nums; }
.tcg-forge__legend-gain {
    font-size: .85rem;
    font-weight: 700;
    color: rgba(var(--forge-ink), .8);
    font-variant-numeric: tabular-nums;
}
.tcg-forge__legend-gain::after { content: " éclats"; font-weight: 400; color: rgba(var(--forge-ink), .5); }

/* Case de rareté : arrondie, remplie de sa couleur. */
.tcg-forge__check {
    appearance: none;
    -webkit-appearance: none;
    flex: 0 0 auto;
    display: grid;
    place-content: center;
    width: 1.1rem;
    height: 1.1rem;
    margin: 0;
    border-radius: .3rem;
    border: 1.5px solid rgba(var(--tier), .8);
    background: #fff;
    cursor: pointer;
    transition: background .15s ease;
}
.tcg-forge__check::after {
    content: "";
    width: .55rem;
    height: .3rem;
    border: 2px solid #fff;
    border-top: 0;
    border-right: 0;
    transform: rotate(-45deg) translate(1px, -1px);
    opacity: 0;
}
.tcg-forge__check:checked { background: var(--tier-ink); border-color: var(--tier-ink); }
.tcg-forge__check:checked::after { opacity: 1; }
.tcg-forge__check:indeterminate { background: rgba(var(--tier), .5); }
.tcg-forge__check:indeterminate::after { opacity: 1; width: .5rem; height: 0; border-left: 0; transform: none; }
.tcg-forge__check:focus-visible { outline: 2px solid rgb(var(--tcg-primary)); outline-offset: 2px; }

/* ---- Tuiles ------------------------------------------------------------ */
.tcg-forge__grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(7.4rem, 1fr));
    gap: .8rem;
    margin: 0;
    padding: 0;
    list-style: none;
}
.tcg-forge__cell { min-width: 0; }

.tcg-forge__tile {
    position: relative;
    display: flex;
    flex-direction: column;
    height: 100%;
    margin: 0;
    padding: .3rem .3rem .45rem;
    border-radius: .75rem;
    background: #fff;
    box-shadow:
        0 0 0 1px rgba(var(--tier), .45),
        0 2px 6px rgba(42, 42, 42, .06),
        0 6px 16px rgba(var(--tier), .12);
    cursor: pointer;
    user-select: none;
    transition: transform .18s ease, box-shadow .18s ease, filter .25s ease, opacity .25s ease;
}
.tcg-forge__tile:hover {
    transform: translateY(-3px);
    box-shadow:
        0 0 0 1.5px rgb(var(--tier)),
        0 4px 10px rgba(42, 42, 42, .08),
        0 12px 24px rgba(var(--tier), .25);
}
/* La case couvre toute la tuile, invisible : le clic tombe dessus directement. Une case masquée
   hors de la tuile, atteinte via le <label>, faisait défiler la liste jusqu'à elle. */
.tcg-forge__input {
    position: absolute;
    inset: 0;
    z-index: 3;
    width: 100%;
    height: 100%;
    margin: 0;
    opacity: 0;
    cursor: pointer;
}
.tcg-forge__tile:has(input:focus-visible) { outline: 2px solid rgb(var(--tcg-primary)); outline-offset: 3px; }

.tcg-forge__art {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    aspect-ratio: 16 / 11;
    border-radius: .5rem;
    overflow: hidden;
    background: linear-gradient(160deg, rgb(var(--theme-a)), rgb(var(--theme-b)));
    color: rgba(255, 255, 255, .75);
    font-size: 1.4rem;
}
.tcg-forge__art::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, transparent 58%, rgba(0, 0, 0, .45));
    pointer-events: none;
}
.tcg-forge__art img { width: 100%; height: 100%; object-fit: cover; transition: transform .3s ease; }
.tcg-forge__tile:hover .tcg-forge__art img { transform: scale(1.06); }

.tcg-forge__qty {
    position: absolute;
    right: .3rem;
    bottom: .25rem;
    z-index: 1;
    font-size: .8rem;
    font-weight: 800;
    color: #fff;
    text-shadow: 0 1px 3px rgba(0, 0, 0, .7);
    font-variant-numeric: tabular-nums;
}

.tcg-forge__name {
    margin: .45rem .2rem .3rem;
    font-size: .8rem;
    font-weight: 700;
    line-height: 1.2;
    color: #2a2a2a;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.tcg-forge__foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .3rem;
    margin: auto .2rem 0;
}
.tcg-forge__pips { display: inline-flex; flex-wrap: wrap; gap: 2px; min-width: 0; }
.tcg-forge__pip {
    width: .4rem;
    height: .55rem;
    border-radius: 1.5px;
    background: rgb(var(--tier));
    transition: background .15s ease, box-shadow .15s ease;
}
.tcg-forge__pip.is-foil { background: linear-gradient(135deg, #ff7ac6, #ffd36b, #6ef0c2, #6ab8ff); }
.tcg-forge__pip.is-off { background: transparent; box-shadow: inset 0 0 0 1px rgba(var(--forge-ink), .3); }
.tcg-forge__dust {
    font-size: .76rem;
    font-weight: 700;
    color: var(--tier-ink);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

/* Gardée : la tuile se décolore, un cadenas le dit. */
.tcg-forge__kept {
    position: absolute;
    inset: 0;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: .2rem;
    background: rgba(var(--forge-bg), .7);
    color: #2a2a2a;
    font-size: .7rem;
    font-weight: 800;
    letter-spacing: .1em;
    text-transform: uppercase;
    opacity: 0;
    transform: scale(1.08);
    transition: opacity .2s ease, transform .2s ease;
}
.tcg-forge__kept i { font-size: 1.05rem; color: rgb(var(--tcg-primary)); }
.tcg-forge__cell.is-kept .tcg-forge__tile {
    filter: grayscale(.85);
    opacity: .6;
    box-shadow: 0 0 0 1px rgba(var(--forge-ink), .12), 0 2px 6px rgba(42, 42, 42, .05);
}
.tcg-forge__cell.is-kept .tcg-forge__tile:hover { opacity: .85; }
.tcg-forge__cell.is-kept .tcg-forge__kept { opacity: 1; transform: none; }
.tcg-forge__cell.is-kept .tcg-forge__dust { visibility: hidden; }

/* ---- Pied : compteur d'éclats et action -------------------------------- */
.tcg-forge__footer {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1rem;
    margin: 0 -1.4rem;
    padding: 1rem 1.4rem 1.2rem;
    background: rgba(255, 255, 255, .85);
    border-top: 1px solid rgba(var(--tcg-primary), .12);
    box-shadow: 0 -8px 24px rgba(42, 42, 42, .05);
}
.tcg-forge__meter { display: flex; align-items: center; gap: .75rem; margin-right: auto; min-width: 0; }
/* La gemme de la pastille de solde (bas gauche) : même teinte, même forme. */
.tcg-forge__meter-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.6rem;
    height: 2.6rem;
    border-radius: 50%;
    background: rgba(var(--tcg-primary), .1);
    color: rgb(var(--tcg-primary));
    font-size: 1.1rem;
}
.tcg-forge__meter-body { display: flex; flex-direction: column; line-height: 1.15; }
.tcg-forge__meter-label {
    font-size: .68rem;
    font-weight: 700;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: rgba(var(--forge-ink), .5);
}
.tcg-forge__meter-value {
    display: inline-flex;
    align-items: baseline;
    gap: .45rem;
    font-variant-numeric: tabular-nums;
}
.tcg-forge__meter-from { font-size: .95rem; color: rgba(var(--forge-ink), .5); }
.tcg-forge__meter-value i { font-size: .6rem; color: rgba(var(--forge-ink), .35); align-self: center; }
.tcg-forge__meter-value strong { font-size: 1.5rem; font-weight: 800; color: #2a2a2a; }
.tcg-forge__meter-gain {
    padding: .05rem .5rem;
    border-radius: 800px;
    background: rgba(var(--tcg-primary), .12);
    color: rgb(var(--tcg-primary));
    font-size: .8rem;
    font-weight: 700;
}

/* Bouton d'action : l'olive du site, en pilule comme l'onglet actif, avec relief et halo. */
.tcg-forge__cta {
    display: inline-flex;
    align-items: center;
    gap: .6rem;
    min-height: 3rem;
    padding: .6rem 1.6rem;
    border: 0;
    border-radius: 800px;
    background: linear-gradient(180deg, color-mix(in srgb, rgb(var(--tcg-primary)) 85%, #fff), rgb(var(--tcg-primary)));
    color: #fff;
    font-weight: 700;
    font-size: .98rem;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, .25),
        0 6px 16px -4px rgba(var(--tcg-primary), .6);
    transition: transform .15s ease, box-shadow .15s ease, filter .15s ease;
}
.tcg-forge__cta:hover:not(:disabled) {
    transform: translateY(-1px);
    filter: brightness(1.06);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .25), 0 10px 22px -4px rgba(var(--tcg-primary), .65);
}
.tcg-forge__cta:active:not(:disabled) { transform: translateY(1px); }
.tcg-forge__cta:focus-visible { outline: 2px solid rgb(var(--tcg-primary)); outline-offset: 3px; }
.tcg-forge__cta:disabled {
    background: rgba(var(--forge-ink), .1);
    color: rgba(var(--forge-ink), .45);
    box-shadow: none;
    cursor: not-allowed;
}
.tcg-forge__cta [data-recycle-count] { font-variant-numeric: tabular-nums; }

@media (max-width: 575.98px) {
    .tcg-forge__grid { grid-template-columns: repeat(auto-fill, minmax(6.2rem, 1fr)); gap: .55rem; }
    .tcg-forge__cta { width: 100%; justify-content: center; }
    .tcg-forge__hint { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
    .tcg-forge__tile, .tcg-forge__tile:hover, .tcg-forge__art img { transition: none; transform: none; }
}

/* ---- Vide -------------------------------------------------------------- */
.tcg-forge__empty { text-align: center; padding: 2rem 1rem 2.5rem; }
.tcg-forge__empty-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 3.6rem;
    height: 3.6rem;
    margin-bottom: 1rem;
    border-radius: 50%;
    background: rgba(var(--tcg-primary), .1);
    color: rgb(var(--tcg-primary));
    font-size: 1.4rem;
}
.tcg-forge__empty-title { margin: 0 0 .35rem; font-family: Marcellus, serif; font-size: 1.25rem; color: #2a2a2a; }
.tcg-forge__empty-text { margin: 0 auto; max-width: 28rem; font-size: .9rem; color: rgba(var(--forge-ink), .6); }

/* ---- Filtre par rareté (vues de collection) ------------------------------ */
.tcg-rarities {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .4rem;
}
.tcg-rarities__label {
    margin-right: .3rem;
    font-size: .75rem;
    font-weight: 700;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: rgba(0, 0, 0, .5);
}
.tcg-rarities__chip {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    padding: .3rem .8rem;
    border-radius: 800px;
    background: rgba(var(--tcg-primary), .06);
    color: rgba(0, 0, 0, .7);
    font-size: .85rem;
    font-weight: 600;
    text-decoration: none;
    box-shadow: inset 0 0 0 1px transparent;
    transition: background .15s ease, box-shadow .15s ease, color .15s ease;
}
.tcg-rarities__chip:hover {
    color: #1d1e20;
    background: #fff;
    box-shadow: inset 0 0 0 1px rgba(var(--tier, var(--tcg-primary)), .55), 0 2px 8px rgba(var(--tier, var(--tcg-primary)), .18);
}
.tcg-rarities__chip.is-active {
    color: #fff;
    background: rgb(var(--tcg-primary));
}
/* Rareté choisie : sa couleur, assombrie pour porter le texte blanc. */
.tcg-rarities__chip[class*="tcg-tier--"].is-active {
    background: color-mix(in srgb, rgb(var(--tier)) 70%, #1d1e20);
    box-shadow: 0 3px 10px rgba(var(--tier), .35);
}
.tcg-rarities__gem {
    width: .55rem;
    height: .55rem;
    transform: rotate(45deg);
    border-radius: 1.5px;
    background: linear-gradient(135deg, #fff, rgb(var(--tier)) 50%);
    box-shadow: 0 0 0 1px rgba(var(--tier), .5), 0 0 6px rgba(var(--tier), .5);
}
.tcg-rarities__chip.is-active .tcg-rarities__gem { box-shadow: 0 0 0 1px rgba(255, 255, 255, .7); }
.tcg-rarities__chip:focus-visible { outline: 2px solid rgb(var(--tcg-primary)); outline-offset: 2px; }

/* ==========================================================================
   Export d'impression (back-office) — `exportPrint` dans crud/cards-tables.js
   La carte est rendue hors écran à sa taille d'impression (300 dpi), coins carrés, avec un fond
   perdu : la bordure de rareté (le fond de `.tcg-card__inner`) s'étend jusqu'au bord, le cadre
   garde son retrait habituel depuis la ligne de coupe. Animations figées, reflets retirés.
   Les dimensions arrivent en variables posées par le script (--print-w/h/bleed/font).
   ========================================================================== */
.tcg-print-stage {
    position: fixed;
    top: 0;
    left: -100000px;
    pointer-events: none;
}

.tcg-print {
    font-family: "Lato", sans-serif;
    line-height: 1.5;
}

.tcg-print .tcg-card {
    width: var(--print-w);
    height: var(--print-h);
    aspect-ratio: auto;
    font-size: var(--print-font);
    perspective: none;
}

.tcg-print .tcg-card__inner {
    border-radius: 0;
    box-shadow: none !important;
    transform: none;
}

.tcg-print .tcg-card__frame,
.tcg-print .tcg-viewer__back .tcg-back { inset: calc(.42em + var(--print-bleed)); }

.tcg-print .tcg-card__glare,
.tcg-print .tcg-card__shine,
.tcg-print .tcg-card__ribbon,
.tcg-print .tcg-card__count,
.tcg-print .tcg-card__foil-mark,
.tcg-print .tcg-card__sale,
.tcg-print .tcg-card--ex .tcg-card__frame::after { display: none; }

.tcg-print *,
.tcg-print *::before,
.tcg-print *::after {
    animation: none !important;
    transition: none !important;
}
