/* Dragon Farm — cartes dragons (prototype) */

:root {
    --df-nuit: #12141b;
    --df-panneau: #1b1e28;
    --df-texte: #e9ebf2;
    --df-discret: #9aa1b3;
}

body.df {
    background: radial-gradient(1200px 600px at 50% -10%, #262b3d 0%, var(--df-nuit) 60%) fixed;
    color: var(--df-texte);
    font-family: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
    min-height: 100vh;
}

/* Les liens sont dorés, SAUF ceux qui ont l'allure d'un bouton (.btn) : ils gardent les couleurs de leur bouton dans tous
   leurs états (repos, survol, appui, grisé). Sans cette exception, un bouton jaune recevait un texte doré, illisible.
   :where() garde à la règle son poids d'origine, pour ne pas l'emporter sur les autres couleurs de liens. */
.df a:where(:not(.btn)), .df a.btn-link { color: #ffcf5a; }
.df .text-discret { color: var(--df-discret); }
/* Le rose de Bootstrap pour <code> (#d63384) est trop sombre sur les panneaux du thème. */
.df code { color: #ff9ecb; }
/* Le vert et le rouge de Bootstrap (#198754, #dc3545) sont faits pour un fond blanc : ici, ceux des jauges. */
.df .text-success { color: #58d68d !important; }
.df .text-danger { color: #ec7063 !important; }
.df h1, .df h2 { font-weight: 800; letter-spacing: .01em; }
.df h2 { font-size: 1.25rem; margin: 2rem 0 .35rem; }
.df .panneau {
    background: var(--df-panneau);
    border: 1px solid #2b3040;
    border-radius: 14px;
    padding: 1rem 1.25rem;
}
.df .nav-pills .nav-link { color: var(--df-texte); border-radius: 999px; padding: .35rem .9rem; }
.df .nav-pills .nav-link.active { background: #ffcf5a; color: #1a1300; font-weight: 700; }
.df table.genes { color: var(--df-texte); font-size: .9rem; }
.df table.genes th { color: var(--df-discret); font-weight: 600; }
.df table.genes td, .df table.genes th { border-color: #2b3040; padding: .35rem .6rem; }
.df .puce {
    display: inline-block; width: .8em; height: .8em; border-radius: 50%;
    vertical-align: -.05em; margin-right: .35em; border: 1px solid rgba(255, 255, 255, .35);
}

/* ---- Grille de cartes --------------------------------------------------- */

.cartes {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 1.4rem 1.2rem;
    justify-items: center;
}
.cartes.serre { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
/* Une rangée de quatre cartes (vitrine) : quatre colonnes centrées sur grand écran, deux fois deux en dessous,
   une seule colonne sur téléphone — jamais trois cartes et une orpheline, jamais un paquet collé à gauche. */
.cartes.par-quatre { grid-template-columns: repeat(4, minmax(0, 270px)); justify-content: center; }
@media (max-width: 991.98px) { .cartes.par-quatre { grid-template-columns: repeat(2, minmax(0, 270px)); } }
@media (max-width: 479.98px) { .cartes.par-quatre { grid-template-columns: minmax(0, 270px); } }
.carte-emplacement { width: 100%; max-width: 270px; container-type: inline-size; }
.carte-lien { text-decoration: none; display: block; }
.carte-lien:hover .carte { transform: translateY(-6px) rotate(-.6deg); }
.carte-note { font-size: .8rem; color: var(--df-discret); text-align: center; margin: .5rem 0 0; }
.carte-note b { color: var(--df-texte); }

/* ---- La carte ----------------------------------------------------------- */

.carte {
    --rarete: #a9b0bf;
    --rarete2: #6d7484;
    position: relative;
    width: 100%;
    aspect-ratio: 5 / 7;
    border-radius: 5.5cqw;
    padding: 3.2cqw;
    background: linear-gradient(145deg, var(--rarete) 0%, var(--rarete2) 45%, var(--rarete) 100%);
    box-shadow: 0 10px 24px rgba(0, 0, 0, .5), 0 1px 0 rgba(255, 255, 255, .25) inset;
    transition: transform .18s ease;
    color: #fff;
    isolation: isolate;
}
.carte.rarete-rare       { --rarete: #5aa8ff; --rarete2: #1f4fb8; }
.carte.rarete-epique     { --rarete: #c58bff; --rarete2: #5b1fb0; }
.carte.rarete-legendaire { --rarete: #ffe08a; --rarete2: #b9770e; }

/* liseré irisé des légendaires */
.carte.rarete-legendaire::before {
    content: "";
    position: absolute; inset: 0; border-radius: inherit; z-index: -1;
    background: conic-gradient(from var(--angle, 0deg), #ffd86b, #ff8fd0, #8fd6ff, #b5ff9a, #ffd86b);
    animation: df-tourne 6s linear infinite;
}
@property --angle { syntax: "<angle>"; inherits: false; initial-value: 0deg; }
@keyframes df-tourne { to { --angle: 360deg; } }

.carte-fond {
    height: 100%;
    border-radius: 3.6cqw;
    padding: 2.4cqw 2.8cqw 2.2cqw;
    display: flex; flex-direction: column; gap: 1.8cqw;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, .10), rgba(0, 0, 0, .28)),
        color-mix(in oklab, var(--fond2) 62%, #0d0f16);
    box-shadow: 0 0 0 .5cqw rgba(0, 0, 0, .35) inset;
}

.carte-entete { display: flex; align-items: center; justify-content: space-between; padding: 0 .6cqw; }
.carte-nom {
    font-size: 7.4cqw; font-weight: 800; letter-spacing: .01em; line-height: 1.1;
    text-shadow: 0 .4cqw 0 rgba(0, 0, 0, .35);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.carte-sexe {
    font-size: 6.4cqw; font-weight: 700; line-height: 1;
    width: 9.2cqw; height: 9.2cqw; border-radius: 50%;
    display: grid; place-items: center; flex: none;
    background: rgba(0, 0, 0, .35);
}
.carte-sexe.sexe-m { color: #7ec8ff; }
.carte-sexe.sexe-f { color: #ff9ed0; }

/* fenêtre d'illustration */
.carte-art {
    position: relative; flex: 1; min-height: 0;
    border-radius: 2.6cqw;
    overflow: hidden;
    background:
        radial-gradient(60% 45% at 50% 96%, rgba(0, 0, 0, .30), transparent 70%),
        radial-gradient(75% 60% at 50% 30%, rgba(255, 255, 255, .55), transparent 70%),
        linear-gradient(180deg, var(--fond1) 0%, color-mix(in oklab, var(--fond1) 45%, var(--fond2)) 55%, var(--fond2) 100%);
    box-shadow: 0 0 0 .5cqw rgba(255, 255, 255, .35) inset, 0 .8cqw 2cqw rgba(0, 0, 0, .35) inset;
    display: flex; align-items: flex-end; justify-content: center;
}
.carte-element {
    position: absolute; top: 2cqw; left: 2cqw; z-index: 3;
    font-size: 3.9cqw; font-weight: 700; text-transform: uppercase; letter-spacing: .08em;
    padding: .7cqw 2.2cqw; border-radius: 99px;
    background: rgba(0, 0, 0, .6); backdrop-filter: blur(2px); /* .6 : le texte blanc reste lisible sur les fonds de palette les plus clairs */
}
/* Le nom de l'espèce, en face de l'élément : même pastille, à droite. Le plus long couple (« Clairière » et
   « Longoreille ») tient côte à côte ; un nom plus long encore serait coupé plutôt que de passer sur l'élément. */
.carte-espece {
    position: absolute; top: 2cqw; right: 2cqw; z-index: 3;
    max-width: 46cqw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    font-size: 3.9cqw; font-weight: 700; text-transform: uppercase; letter-spacing: .08em;
    padding: .7cqw 2.2cqw; border-radius: 99px;
    background: rgba(0, 0, 0, .6); backdrop-filter: blur(2px);
}
.carte-sujet {
    position: relative; z-index: 2;
    width: var(--taille); aspect-ratio: 1;
    margin-bottom: 1.5cqw;
}
.carte-sujet img { width: 100%; height: 100%; display: block; filter: drop-shadow(0 1.6cqw 1.6cqw rgba(0, 0, 0, .35)); }

/* bandeau stade / rareté */
.carte-bandeau {
    display: flex; align-items: center; justify-content: space-between;
    font-size: 4.2cqw; font-weight: 700; padding: 0 .6cqw;
}
.carte-stade { text-transform: uppercase; letter-spacing: .08em; }
.carte-pastilles { display: flex; gap: 1.2cqw; }
.carte-pastilles i {
    width: 2.6cqw; height: 2.6cqw; border-radius: 50%;
    background: rgba(255, 255, 255, .18); box-shadow: 0 0 0 .35cqw rgba(0, 0, 0, .3) inset;
}
.carte-pastilles i.on { background: var(--rarete); box-shadow: 0 0 1.6cqw var(--rarete); }
/* Le mot est éclairci (les pastilles et le cadre gardent la couleur vive) : la couleur pure se perdait sur les fonds clairs. */
.carte-rarete { color: color-mix(in oklab, var(--rarete) 60%, #fff); }

.carte-stats {
    list-style: none; margin: 0; padding: 0;
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.4cqw;
}
.carte-stats li {
    background: rgba(0, 0, 0, .34); border-radius: 1.8cqw;
    padding: 1.1cqw 0 1.3cqw; text-align: center;
    font-size: 6cqw; font-weight: 800; line-height: 1.05;
}
.carte-stats b { display: block; font-size: 3.2cqw; font-weight: 700; letter-spacing: .12em; opacity: .7; }

.carte-pied {
    display: flex; justify-content: space-between; align-items: baseline;
    font-size: 3.1cqw; opacity: .72; padding: 0 .6cqw;
}
.carte-adn { font-family: Consolas, "Courier New", monospace; }

/* ---- Stades -------------------------------------------------------------- */

.carte.stade-3 .carte-sujet img {
    filter: drop-shadow(0 1.6cqw 1.6cqw rgba(0, 0, 0, .4)) drop-shadow(0 0 2.4cqw color-mix(in oklab, var(--fond1) 70%, transparent));
}

/* Méga : rayons tournants derrière, halo, reflet irisé découpé sur le dragon */
.carte.stade-4 .carte-art::before {
    content: ""; position: absolute; inset: -40%; z-index: 1;
    background: repeating-conic-gradient(from 0deg, rgba(255, 255, 255, .0) 0deg 9deg, rgba(255, 255, 255, .22) 9deg 18deg);
    mask-image: radial-gradient(circle, #000 0%, transparent 62%);
    -webkit-mask-image: radial-gradient(circle, #000 0%, transparent 62%);
    animation: df-rotation 28s linear infinite;
}
@keyframes df-rotation { to { transform: rotate(360deg); } }
.carte.stade-4 .carte-sujet img {
    filter: drop-shadow(0 1.6cqw 1.6cqw rgba(0, 0, 0, .45)) drop-shadow(0 0 2cqw #fff) drop-shadow(0 0 5cqw var(--fond1));
}
.carte-reflet {
    position: absolute; inset: 0; z-index: 3; pointer-events: none;
    -webkit-mask-size: contain; mask-size: contain;
    -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
    -webkit-mask-position: center; mask-position: center;
    background: linear-gradient(115deg,
        transparent 20%, rgba(255, 120, 200, .55) 32%, rgba(120, 220, 255, .6) 44%,
        rgba(255, 255, 255, .75) 50%, rgba(170, 255, 150, .55) 56%, rgba(255, 220, 110, .55) 68%, transparent 80%);
    background-size: 260% 100%;
    mix-blend-mode: soft-light;
    animation: df-reflet 4.5s ease-in-out infinite;
}
@keyframes df-reflet { 0% { background-position: 120% 0; } 100% { background-position: -20% 0; } }

/* ---- Auras --------------------------------------------------------------- */

.carte.aura-braises .carte-sujet img {
    filter: drop-shadow(0 0 1.2cqw #ffd27a) drop-shadow(0 0 3.5cqw #ff6a1a) drop-shadow(0 -1cqw 6cqw #ff2d00);
}
.carte.aura-givre .carte-sujet img {
    filter: drop-shadow(0 0 1.2cqw #ffffff) drop-shadow(0 0 3.5cqw #8fe6ff) drop-shadow(0 0 7cqw #3a8dff);
}
.carte.aura-etoiles .carte-sujet img {
    filter: drop-shadow(0 0 1.2cqw #fff7c2) drop-shadow(0 0 4cqw #c58bff);
}
.carte.aura-etoiles .carte-art::after,
.carte.aura-braises .carte-art::after,
.carte.aura-givre .carte-art::after {
    content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none;
    background-image:
        radial-gradient(circle, #fff 0 1.1px, transparent 1.8px),
        radial-gradient(circle, #fff 0 1.6px, transparent 2.4px),
        radial-gradient(circle, #fff 0 .9px, transparent 1.6px);
    background-size: 37px 41px, 61px 53px, 23px 29px;
    background-position: 5px 9px, 31px 17px, 13px 3px;
    opacity: .75;
    animation: df-scintille 3s ease-in-out infinite alternate;
}
.carte.aura-braises .carte-art::after { filter: sepia(1) saturate(8) hue-rotate(-20deg); opacity: .6; }
.carte.aura-givre .carte-art::after { filter: sepia(1) saturate(4) hue-rotate(160deg); opacity: .7; }
@keyframes df-scintille { from { opacity: .35; } to { opacity: .9; } }

@media (prefers-reduced-motion: reduce) {
    .carte.rarete-legendaire::before, .carte.stade-4 .carte-art::before, .carte-reflet, .carte-art::after { animation: none !important; }
}

/* ---- Divers -------------------------------------------------------------- */

.origine {
    background: repeating-conic-gradient(#2a2e3b 0 25%, #20232e 0 50%) 0 0 / 22px 22px;
    border-radius: 14px; padding: .5rem; text-align: center;
}
.origine img { width: 100%; max-width: 230px; aspect-ratio: 1; }
.nuancier { display: flex; flex-wrap: wrap; gap: 3px; }
.nuancier span { width: 22px; height: 22px; border-radius: 4px; }
.fleche { font-size: 1.6rem; color: var(--df-discret); }

/* ---- Cœurs d'un dragon prêt à s'accoupler ------------------------------------------------------------------- */
/* Cinq cœurs partent de la poitrine du dragon et s'envolent en se dispersant. Unités cqw : ils suivent la taille de la carte. */
.carte-coeurs { position: absolute; inset: 0; z-index: 4; pointer-events: none; overflow: hidden; border-radius: inherit; }
.carte-coeurs i {
    position: absolute; left: 50%; top: 66%;   /* la poitrine du dragon */
    font-style: normal; font-size: var(--t, 9cqw); line-height: 1; font-family: "Segoe UI Symbol", "Arial Unicode MS", Arial, sans-serif;
    color: #ff4f9f;
    /* liseré blanc par ombres (un contour de texte mangerait le rose), puis une ombre portée pour les fonds clairs */
    text-shadow: 0 0 .5cqw #fff, 0 0 .5cqw #fff, 0 0 1cqw #fff, 0 .5cqw 1.4cqw rgba(0, 0, 0, .45);
    opacity: 0; will-change: transform, opacity;
    animation: df-coeur var(--d, 3.6s) linear var(--r, 0s) infinite;
}
.carte-coeurs i::before { content: "\2665\FE0E"; }   /* ♥ en texte, jamais en émoji */
.carte-coeurs i:nth-child(1) { --dx: -15cqw; --rot: -16deg; --d: 3.6s; --r: 0s;   --t: 9cqw; }
.carte-coeurs i:nth-child(2) { --dx: 13cqw;  --rot: 14deg;  --d: 4.2s; --r: .8s;  --t: 7cqw; }
.carte-coeurs i:nth-child(3) { --dx: -4cqw;  --rot: 8deg;   --d: 3.9s; --r: 1.6s; --t: 10.5cqw; }
.carte-coeurs i:nth-child(4) { --dx: 23cqw;  --rot: 20deg;  --d: 4.5s; --r: 2.4s; --t: 8cqw; }
.carte-coeurs i:nth-child(5) { --dx: -24cqw; --rot: -22deg; --d: 4.1s; --r: 3.1s; --t: 6.5cqw; }
@keyframes df-coeur {
    0%   { transform: translate(-50%, 0) scale(.3) rotate(0deg); opacity: 0; }
    10%  { opacity: 1; }
    22%  { transform: translate(calc(-50% + var(--dx, 0cqw) * .2), -12cqw) scale(1) rotate(0deg); }
    78%  { opacity: 1; }
    100% { transform: translate(calc(-50% + var(--dx, 0cqw)), -54cqw) scale(1.12) rotate(var(--rot, 0deg)); opacity: 0; }
}
/* Sans animation : un seul cœur, posé près de la poitrine. */
@media (prefers-reduced-motion: reduce) {
    .carte-coeurs i { animation: none; display: none; }
    .carte-coeurs i:first-child { display: block; opacity: 1; transform: translate(60%, -120%) rotate(12deg); }
}
