/* ==========================================================================
   POKÉGROUIK — COLLECTION
   Feuille de style finale, extraite de collection.php puis optimisée.
   ========================================================================== */

:root {
        --bg-color: #0a0a0a;
        --card-bg: #1a1a1a;
        --accent: #f5c542;
        --transfer-color: #e74c3c;
        --up-color: #3498db;
        --ready-color: #27ae60;
        --evolve-color: #f1c40f;
        --archive-bg: #111;
    }

    body { background-color: var(--bg-color); color: white; font-family: 'Poppins', sans-serif; margin: 0; padding: 20px; transition: background-color 0.3s; }
    .container { width: 100%; max-width: 1400px; margin: 0 auto; }

    .modal { 
        display: none; position: fixed; z-index: 10000; left: 0; top: 0; width: 100%; height: 100%; 
        background-color: rgba(0,0,0,0.85); justify-content: center; align-items: center; 
    }
    .modal-content { 
        background-color: #1a1a1a; padding: 20px; border: 2px solid var(--up-color); border-radius: 12px; 
        width: 320px; text-align: center; box-shadow: 0 0 20px rgba(0,0,0,0.5);
    }

    .xp-number-input { background: #000; border: 1px solid var(--up-color); color: white; width: 100px; text-align: center; font-size: 20px; margin-bottom: 10px; }
    #xpRange { width: 100%; margin: 15px 0; }
    
    .link-back {
        display: inline-flex; align-items: center; background: rgba(255, 255, 255, 0.05); color: var(--text-main);
        text-decoration: none; padding: 6px 15px; border-radius: 6px; border: 2px solid var(--accent);
        font-weight: 800; font-size: 10px; margin-top: 10px; text-transform: uppercase; transition: all 0.2s ease-in-out; cursor: pointer;
    }
    .link-back:hover { background: rgba(245, 197, 66, 0.85); color: #000; box-shadow: 0 0 8px rgba(245, 197, 66, 0.3); transform: translateY(-1px); }

    .btn-sort { background: #222; border: 1px solid #444; color: #ccc; padding: 5px 12px; border-radius: 6px; font-size: 10px; font-weight: 600; cursor: pointer; transition: 0.2s; }
    .btn-sort:hover { border-color: var(--accent); color: white; background: #333; }
    .btn-sort.active { background: var(--accent); color: #000; border-color: var(--accent); }

    @keyframes pulse-red {
        0% { box-shadow: 0 0 0 0 rgba(231, 76, 60, 0.7); }
        70% { box-shadow: 0 0 0 15px rgba(231, 76, 60, 0); }
        100% { box-shadow: 0 0 0 0 rgba(231, 76, 60, 0); }
    }
    .transfer-mode #toggleTransfer { animation: pulse-red 1.5s infinite; background: #c0392b !important; border: 2px solid white !important; }
    body.transfer-mode { background-color: #050505; }
    .transfer-mode .section-wrapper:not(#section-actifs) { opacity: 0.3; pointer-events: none; }
    .transfer-mode .pokemon-card.selected { border: 3px solid var(--transfer-color) !important; background: rgba(231, 76, 60, 0.2) !important; transform: scale(0.95); }
	.header { border: 2px solid var(--accent); border-radius: 16px; padding: 20px; margin-bottom: 30px; background: linear-gradient(180deg, #151515, #050505); display: flex; justify-content: space-between; align-items: center; overflow: hidden; }
    .stats-container {
display: grid;
grid-template-columns: repeat(4, 1fr);
gap: 12px;
flex-grow: 1;
margin: 0 30px;
}
.stat-item {
background: rgba(255,255,255,0.05);
padding: 10px 14px;
border-radius: 12px;
border: 1px solid #333;
text-align: center;
display: flex;
flex-direction: column;
justify-content: center;
}
    .stat-label { font-size: 10px; color: var(--accent); font-weight: 800; text-transform: uppercase; display: block; }
    .stat-value {    font-size: 18px; font-weight: 900; color: white;}
    .achievements-row {display: grid; grid-template-columns: repeat(6, 35px);gap: 8px; margin-right: 20px; align-content: center;}
/* ===== BADGES ===== */

.badge
{
    width: 35px;
    height: 35px;

    border-radius: 50%;

    background: #1a1a1a;
    border: 2px solid #444;

    display: flex;
    align-items: center;
    justify-content: center;

    position: relative;
    cursor: help;

    filter: grayscale(1);
    opacity: 0.45;

    z-index: 1;
}


/* ===== BADGE DÉBLOQUÉ ===== */

.badge.unlocked
{
    filter: grayscale(0);
    opacity: 1;

    border: 2px solid var(--accent);

    background: linear-gradient(
        135deg,
        #333,
        #111
    );
}


/* ===== TOOLTIP ===== */

.badge .tooltip
{
    display: none;

    position: fixed;

    background: #000;
    color: #fff;

    padding: 10px;

    width: 200px;

    border-radius: 6px;
    border: 1px solid #555;

    font-size: 12px;
    text-align: center;

    z-index: 999999;
}


/* ===== APPARITION TOOLTIP ===== */

.badge:hover .tooltip
{
    display: block;
}

/* ===== PRIORITÉ AU HOVER ===== */

.badge:hover
{
    z-index: 999998;
}
    .section-header { background: #151515; padding: 15px 20px; border-radius: 12px; border-left: 5px solid var(--accent); margin: 20px 0 10px; cursor: pointer; display: flex; justify-content: space-between; align-items: center; }
    .section-title { font-size: 18px; font-weight: 800; color: var(--accent); text-transform: uppercase; margin: 0; }
    .section-icon { transition: transform 0.3s; font-size: 20px; }
    .collapsible-content { max-height: 20000px; overflow: hidden; transition: max-height 0.5s ease-in-out, opacity 0.3s; }
    .is-closed .collapsible-content { max-height: 0; opacity: 0; }
    .is-closed .section-icon { transform: rotate(-90deg); }

    .grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 15px; padding: 10px 0 40px; }
    .pokemon-card { background: var(--card-bg); border-radius: 12px; padding: 15px; text-align: center; position: relative; border: 1px solid #333; display: flex; flex-direction: column; min-height: 280px; transition: 0.2s; }
    .pokemon-card img { width: 90px; height: 90px; margin: 0 auto; }
    .pokemon-id { position: absolute; top: 8px; right: 8px; font-size: 10px; color: var(--accent); font-weight: bold; }
	.breed-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    width: 26px;
    height: 26px;
    border-radius: 50%;

    display: flex;
    align-items: center;
    justify-content: center;

    font-size: 15px;
    background: rgba(0,0,0,0.75);
    border: 1px solid #333;

    z-index: 20;
    cursor: help;
}

.breed-badge.can-breed {
    color: #ffd86b;
    border-color: #f5c542;
    box-shadow: 0 0 10px rgba(245,197,66,0.75);
}

.breed-badge.used-breed {
    color: #555;
    border-color: #333;
    opacity: 0.45;
    filter: grayscale(1);
}

.breed-badge.too-low {
    color: #777;
    border-color: #333;
    opacity: 0.28;
    filter: grayscale(1);
}
    .pokemon-name { font-weight: 600; font-size: 13px; text-transform: uppercase; margin: 5px 0; }

    .not-owned { opacity: 0.5; }
    .not-owned img { filter: brightness(0); }
    .archived { background: var(--archive-bg); opacity: 0.8; filter: saturate(0.6); border: 1px dashed #444; }

    .history-info { background: rgba(0,0,0,0.6); padding: 12px 5px; border-radius: 10px; margin-top: auto; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; min-height: 85px; border: 1px solid rgba(255,255,255,0.05); }
    .history-info .status-line { font-size: 11px; font-weight: 800; text-transform: uppercase; }
    .history-info .date-line { font-size: 10px; opacity: 0.7; }

    .xp-bar-container { background: #000; height: 6px; border-radius: 3px; margin: 10px 0; overflow: hidden; border: 1px solid #333; }
    .xp-bar-fill { background: var(--ready-color); height: 100%; transition: width 0.3s; }

    .btn-card { width: 100%; border: 1px solid; padding: 6px; border-radius: 8px; font-size: 9px; font-weight: 800; cursor: pointer; text-transform: uppercase; margin-top: 5px; background: transparent; transition: 0.2s; }
    .btn-up { color: var(--up-color); border-color: var(--up-color); }
    .btn-transfer { color: var(--transfer-color); border-color: var(--transfer-color); }

    @media (max-width: 768px) {
        .header { flex-direction: column; gap: 15px; text-align: center; }
        .stats-container { margin: 10px 0; width: 100%; display: grid; grid-template-columns: 1fr 1fr; }
        .grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
    }
	
	/* Animation de pulsation dorée pour l'évolution */
@keyframes pulse-gold {
    0% { box-shadow: 0 0 0 0 rgba(241, 196, 15, 0.7); transform: scale(1); }
    70% { box-shadow: 0 0 0 10px rgba(241, 196, 15, 0); transform: scale(1.02); }
    100% { box-shadow: 0 0 0 0 rgba(241, 196, 15, 0); transform: scale(1); }
}

.btn-evolve-ready {
    animation: pulse-gold 2s infinite;
    background: rgba(241, 196, 15, 0.2) !important;
    border: 2px solid var(--evolve-color) !important;
    font-weight: 900 !important;
    letter-spacing: 1px;
}


.btn-fav {
    color: #f1c40f;
    border-color: #f1c40f;
}

.btn-fav:hover {
    background: #f1c40f;
    color: #000;
}

.btn-fav-remove {
    color: #e67e22;
    border-color: #e67e22;
}

.btn-fav-remove:hover {
    background: #e67e22;
    color: #000;
}
/* Aura néon pour Pokémon favoris */
.pokemon-card.favorite-glow {
    border: 1px solid #f1c40f !important;
    box-shadow:
        0 0 5px rgba(241, 196, 15, 0.6),
        0 0 15px rgba(241, 196, 15, 0.4),
        0 0 25px rgba(241, 196, 15, 0.2);
    transition: box-shadow 0.3s ease, transform 0.2s ease;
}

.pokemon-card.favorite-glow:hover {
    box-shadow:
        0 0 8px rgba(241, 196, 15, 0.8),
        0 0 20px rgba(241, 196, 15, 0.6),
        0 0 35px rgba(241, 196, 15, 0.3);
}
/* Aura argentée pour Pokédex complet (♂ + ♀) */

.pokedex-complete {
    border: 1px solid #c0c0c0 !important;

    box-shadow:
        0 0 5px rgba(192,192,192,0.8),
        0 0 15px rgba(192,192,192,0.6),
        0 0 25px rgba(192,192,192,0.4);

    transition: box-shadow 0.3s ease, transform 0.2s ease;
}

.pokedex-complete:hover {
    box-shadow:
        0 0 8px rgba(220,220,220,0.9),
        0 0 20px rgba(220,220,220,0.7),
        0 0 35px rgba(220,220,220,0.5);
}

.header-stats
{
    display: grid;

    grid-template-columns: repeat(3, 1fr);

    gap: 12px;

    margin: 0 30px;
}

.stat-item
{
    background: #151515;

    border: 1px solid #333;

    border-radius: 10px;

    padding: 10px;

    text-align: center;
}
/* ===== SHINY POKEMON ===== */

@keyframes shiny-fire {

    0% {
        box-shadow:
            0 0 5px rgba(255,80,0,0.8),
            0 0 10px rgba(255,40,0,0.6),
            0 0 20px rgba(255,0,0,0.4);
    }

    50% {
        box-shadow:
            0 0 10px rgba(255,120,0,1),
            0 0 20px rgba(255,60,0,0.8),
            0 0 35px rgba(255,0,0,0.6);
    }

    100% {
        box-shadow:
            0 0 5px rgba(255,80,0,0.8),
            0 0 10px rgba(255,40,0,0.6),
            0 0 20px rgba(255,0,0,0.4);
    }

}

.pokemon-card.shiny-card {

    border: 1px solid #ff3c00 !important;

    animation: shiny-fire 2s infinite;

}
.pokedex-sprite[data-shiny="1"] {
    cursor: pointer;
}
/* ===== FLIP CARTE POKEDEX ===== */

.pokemon-card {
    perspective: 1000px;
}

.card-inner {
    position: relative;
    width: 100%;
    height: 90px;
    transition: transform 0.6s;
    transform-style: preserve-3d;
    cursor: pointer;
}

.card-inner.flipped {
    transform: rotateY(180deg);
}

.card-front,
.card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;

    display: flex;
    align-items: center;
    justify-content: center;
}

.card-front img,
.card-back img {
    width: 90px;
    height: 90px;
}

.card-back {
    transform: rotateY(180deg);
}

/* ===== FLIP CARTE COMPLETE ===== */

.pokemon-card{
perspective:1000px;
}

.card-inner{
position:relative;
width:100%;
height:100%;
transition:transform 0.6s;
transform-style:preserve-3d;
}

.pokemon-card.flipped .card-inner{
transform:rotateY(180deg);
}

.card-front,
.card-back{
position:absolute;
width:100%;
height:100%;
backface-visibility:hidden;

display:flex;
flex-direction:column;
align-items:center;
justify-content:center;
}

.card-back{
transform:rotateY(180deg);
}

.heal-grid{
display:grid;
grid-template-columns:repeat(auto-fill,minmax(120px,1fr));
gap:12px;
margin-top:15px;
}

.heal-item{
background:#1a1a1a;
border:1px solid #333;
border-radius:10px;
padding:10px;
text-align:center;
}

.heal-item img{
width:50px;
height:50px;
object-fit:contain;
margin-bottom:5px;
}

.heal-name{
font-size:11px;
font-weight:800;
text-transform:uppercase;
}

.heal-qte{
color:#2ecc71;
font-weight:800;
margin:4px 0;
}

.heal-item button{
background:#222;
border:1px solid #444;
border-radius:6px;
padding:5px 8px;
color:white;
font-size:11px;
cursor:pointer;
}

.heal-item button:hover{
border-color:#2ecc71;
color:#2ecc71;
}

.hp-bar{
height:8px;
background:#222;
border-radius:6px;
overflow:hidden;
margin-top:4px;
}

.hp-fill{
height:100%;
background:#2ecc71;
transition:width 0.4s ease;
}


.heal-effect{
animation:healFlash 0.5s;
}

@keyframes healFlash{
0%{box-shadow:0 0 0 rgba(46,204,113,0);}
50%{box-shadow:0 0 15px rgba(46,204,113,0.8);}
100%{box-shadow:0 0 0 rgba(46,204,113,0);}
}

.header-actions {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 10px;
    min-width: 220px;
    flex-shrink: 0;
    margin-left: auto;
}

/* =========================================================
   PATCH AFFICHAGE MOBILE / TABLETTE / ZOOM PC
========================================================= */

body {
    overflow-x: hidden;
}

/* Quand une section est ouverte, on évite de couper le contenu */
.collapsible-content {
    max-height: none;
    overflow: visible;
    opacity: 1;
    transition: opacity 0.3s ease-in-out;
}

.is-closed .collapsible-content {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
}

/* ===== MODALE OBJETS RESPONSIVE + SCROLLABLE ===== */
#healModal {
    display: none;
    position: fixed;
    inset: 0;
    padding: 20px;
    box-sizing: border-box;
    background: rgba(0,0,0,0.82);
    z-index: 9999;
    align-items: center;
justify-content: center;
    overflow-y: auto;
    overscroll-behavior: contain;
}

#healContent {
    background: #111;
    border: 2px solid #2ecc71;
    border-radius: 12px;
    width: min(400px, 100%);
    max-height: min(85vh, calc(100dvh - 40px));
    margin: auto;
    padding: 20px;
    text-align: center;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* grille d'objets scrollable à l'intérieur de la modale */
#healContent .heal-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 12px;
    margin-top: 15px;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 4px;
    min-height: 0;
    flex: 1 1 auto;
}

/* scrollbar visible dans la modale */
#healContent .heal-grid::-webkit-scrollbar {
    width: 8px;
}

#healContent .heal-grid::-webkit-scrollbar-track {
    background: #0d0d0d;
    border-radius: 8px;
}

#healContent .heal-grid::-webkit-scrollbar-thumb {
    background: #2ecc71;
    border-radius: 8px;
}

/* items objets */
#healContent .heal-item {
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 10px;
    padding: 10px;
    text-align: center;
}

#healContent .heal-item img {
    width: 50px;
    height: 50px;
    object-fit: contain;
    margin-bottom: 5px;
}

#healContent .heal-name {
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    word-break: break-word;
}

#healContent .heal-qte {
    color: #2ecc71;
    font-weight: 800;
    margin: 4px 0;
}

#healContent .heal-item button {
    background: #222;
    border: 1px solid #444;
    border-radius: 6px;
    padding: 5px 8px;
    color: white;
    font-size: 11px;
    cursor: pointer;
}

#healContent .heal-item button:hover {
    border-color: #2ecc71;
    color: #2ecc71;
}

/* sur mobile/tablette : on rend les sections plus robustes */
@media (max-width: 1024px) {
    #section-favoris .grid,
    #section-actifs .grid,
    #section-archives .grid,
    #section-pokedex .grid {
        grid-template-columns: repeat(auto-fit, minmax(145px, 1fr));
    }
}

/* téléphone */
@media (max-width: 768px) {
    #healModal {
        padding: 12px;
        align-items: flex-start;
    }

    #healContent {
        width: 100%;
        max-height: calc(100dvh - 24px);
        margin: 0 auto;
        padding: 16px;
    }

    #healContent .heal-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
    }

    #healContent .heal-item {
        padding: 8px;
    }

    #healContent .heal-item img {
        width: 44px;
        height: 44px;
    }

    #section-favoris .grid,
    #section-actifs .grid,
    #section-archives .grid {
        grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    }
}

.desc-btn {
    margin-top: 8px;
    width: 100%;
    border: 1px solid var(--accent);
    background: rgba(245, 197, 66, 0.08);
    color: var(--accent);
    border-radius: 8px;
    padding: 6px;
    font-size: 10px;
    font-weight: 800;
    cursor: pointer;
    text-transform: uppercase;
    transition: 0.2s;
}

.desc-btn:hover {
    background: var(--accent);
    color: #000;
}

#descModal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.85);
    z-index: 10001;
    justify-content: center;
    align-items: center;
    padding: 20px;
    box-sizing: border-box;
}

#descModalContent {
    width: min(520px, 100%);
    background: #111;
    border: 2px solid var(--accent);
    border-radius: 14px;
    padding: 22px;
    box-sizing: border-box;
    box-shadow: 0 0 25px rgba(0,0,0,0.45);
}

#descModalTitle {
    margin: 0 0 12px 0;
    color: var(--accent);
    font-size: 20px;
    font-weight: 800;
    text-transform: uppercase;
}

#descModalText {
    color: #f1f1f1;
    font-size: 14px;
    line-height: 1.6;
    white-space: normal;
}

.desc-close-btn {
    margin-top: 18px;
    width: 100%;
    border: none;
    border-radius: 8px;
    padding: 10px;
    background: var(--accent);
    color: #000;
    font-weight: 800;
    cursor: pointer;
    text-transform: uppercase;
}
#section-pokedex .grid {
    gap: 20px;
    padding-top: 18px;
}

#section-pokedex .pokemon-card {
    min-height: 250px !important;
    padding: 16px 14px 18px;
    justify-content: flex-start;
}

#section-pokedex .pokemon-name {
    margin: 10px 0 8px;
    min-height: 32px;
    line-height: 1.2;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

#section-pokedex .desc-btn {
    margin: 10px 0 12px;
    padding: 8px;
    font-size: 11px;
}

#section-pokedex .pokemon-card > div[style*="font-size:10px;margin-top:auto;"] {
    margin-top: 6px !important;
    line-height: 1.45;
}

#section-pokedex .pokemon-card > div[style*="font-size:10px;margin-top:auto;"] > div {
    margin-bottom: 4px;
}

#section-pokedex .pokemon-card > div[style*="font-size:10px;margin-top:auto;"] > div:last-child {
    margin-bottom: 0;
}

#section-pokedex .card-inner {
    height: 100px;
    margin-top: 4px;
    margin-bottom: 6px;
}

#section-pokedex .pokedex-meta {
    font-size: 10px;
    margin-top: auto;
    line-height: 1.45;
    padding-top: 2px;
}

#section-pokedex .pokedex-meta > div {
    margin-bottom: 4px;
}

#section-pokedex .pokedex-meta > div:last-child {
    margin-bottom: 0;
}
.cry-btn {
    margin: 0 0 12px;
    width: 100%;
    border: 1px solid #3da5ff;
    background: rgba(61, 165, 255, 0.08);
    color: #3da5ff;
    border-radius: 8px;
    padding: 6px;
    font-size: 10px;
    font-weight: 800;
    cursor: pointer;
    text-transform: uppercase;
    transition: 0.2s;
}

.cry-btn:hover {
    background: #3da5ff;
    color: #000;
}

.pokedex-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
    margin: 10px 0 12px;
}
.pokedex-search-bar {
    padding: 12px 20px;
    background: rgba(255,255,255,0.02);
    border-bottom: 1px solid #333;
    display: flex;
    justify-content: flex-start;
}

.pokedex-search-input {
    width: 320px;
    max-width: 100%;
    padding: 9px 12px;
    border-radius: 8px;
    border: 1px solid #444;
    background: #111;
    color: white;
    font-size: 11px;
    outline: none;
}

.pokedex-region-wrapper {
    margin-top: 18px;
}

.pokedex-region-header {
    background: #111;
    padding: 12px 18px;
    border-radius: 10px;
    border-left: 4px solid var(--accent);
    margin: 0 0 10px 0;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.pokedex-region-title {
    font-size: 14px;
    font-weight: 800;
    color: var(--accent);
    text-transform: uppercase;
    margin: 0;
}

.pokedex-region-icon {
    transition: transform 0.3s;
    font-size: 18px;
}

.pokedex-region-content {
    max-height: 20000px;
    overflow: hidden;
    transition: max-height 0.4s ease, opacity 0.25s ease;
    opacity: 1;
}

.pokedex-region-wrapper.is-closed .pokedex-region-content {
    max-height: 0;
    opacity: 0;
}

.pokedex-region-wrapper.is-closed .pokedex-region-icon {
    transform: rotate(-90deg);
}

.pokedex-empty-region {
    padding: 14px 6px 8px;
    color: #777;
    font-size: 12px;
    font-weight: 600;
    text-align: center;
}

#section-pokedex .grid {
    gap: 20px;
    padding-top: 12px;
}

#section-pokedex .pokemon-card {
    min-height: 265px !important;
    padding: 16px 14px 18px;
    justify-content: flex-start;
}

#section-pokedex .pokemon-name {
    margin: 10px 0 8px;
    min-height: 32px;
    line-height: 1.2;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

#section-pokedex .pokedex-meta {
    font-size: 10px;
    margin-top: auto;
    line-height: 1.45;
    padding-top: 2px;
}

#section-pokedex .pokedex-meta > div {
    margin-bottom: 4px;
}

#section-pokedex .pokedex-meta > div:last-child {
    margin-bottom: 0;
}
.breed-badge.too-low {
    color: #888;
    border-color: #333;
    opacity: 0.45;
    filter: grayscale(1);
    font-size: 13px;
}
.pokemon-card.locked-box {
    opacity: 0.65;
    border-color: #9b7cff !important;
    box-shadow: 0 0 14px rgba(155, 124, 255, 0.35);
}

.box-lock-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(20, 12, 40, 0.95);
    border: 1px solid #9b7cff;
    color: #d8c8ff;
    font-size: 11px;
    font-weight: 900;
    padding: 4px 7px;
    border-radius: 999px;
    z-index: 30;
    text-transform: uppercase;
}

.pokemon-card.locked-box button,
.pokemon-card.locked-box .btn-card,
.pokemon-card.locked-box .transfer-checkbox {
    opacity: 0.35;
    pointer-events: none;
}

/* =========================================================
   BADGES V5 : TYPES ET ARCHÉTYPES
========================================================= */
.pokemon-traits {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 5px;
    margin: 6px 0 8px;
    min-height: 23px;
}

.trait-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 21px;
    padding: 3px 8px;
    border-radius: 999px;
    border: 1px solid rgba(255,255,255,0.18);
    font-size: 9px;
    line-height: 1;
    font-weight: 900;
    letter-spacing: 0.25px;
    text-transform: uppercase;
    color: #fff;
    box-sizing: border-box;
    white-space: nowrap;
}

.type-badge {
    min-width: 52px;
    text-shadow: 0 1px 2px rgba(0,0,0,0.6);
}

.type-normal    { background: #8f9098; }
.type-feu       { background: #e85b3f; }
.type-eau       { background: #3f83d8; }
.type-electrik  { background: #d9aa24; color: #111; text-shadow: none; }
.type-plante    { background: #4b9c50; }
.type-glace     { background: #55aeb9; }
.type-combat    { background: #b3413f; }
.type-poison    { background: #8f4b9f; }
.type-sol       { background: #b78145; }
.type-vol       { background: #7189c7; }
.type-psy       { background: #d64d78; }
.type-insecte   { background: #82952f; }
.type-roche     { background: #9a874b; }
.type-spectre   { background: #5f547e; }
.type-dragon    { background: #6655b8; }
.type-tenebres  { background: #514943; }
.type-acier     { background: #727f8c; }
.type-fee       { background: #cc78a8; }
.type-unknown   { background: #3f3f3f; color: #aaa; }

.archetype-badge {
    flex-basis: 100%;
    width: max-content;
    max-width: 100%;
    margin: 1px auto 0;
    border-width: 1px;
    background: rgba(0,0,0,0.32);
}

.archetype-bagarreur {
    color: #ff8a80;
    border-color: #e85b50;
    box-shadow: inset 0 0 10px rgba(232,91,80,0.18);
}

.archetype-protecteur {
    color: #7ec8ff;
    border-color: #3498db;
    box-shadow: inset 0 0 10px rgba(52,152,219,0.18);
}

.archetype-feinteur {
    color: #d7a6ff;
    border-color: #9b59b6;
    box-shadow: inset 0 0 10px rgba(155,89,182,0.18);
}

.archetype-legacy {
    color: #aaa;
    border-color: #555;
    background: rgba(255,255,255,0.035);
}

.archetype-missing {
    color: #ffb74d;
    border-color: #ff9800;
    background: rgba(255,152,0,0.08);
}

#section-pokedex .pokemon-card {
    min-height: 292px !important;
}

#section-pokedex .pokemon-traits {
    margin: 0 0 9px;
    min-height: 21px;
}

#section-pokedex .trait-badge {
    font-size: 8px;
    min-height: 19px;
    padding: 3px 7px;
}

.archived .pokemon-traits {
    opacity: 0.8;
}

/* ==========================================================================
   POKÉGROUIK — COLLECTION FINALE OPTIMISÉE
   --------------------------------------------------------------------------
   Base fonctionnelle issue du CSS historique de collection.php.
   Les règles ci-dessous modernisent l'interface tout en privilégiant le coût
   de rendu : pas de flou, pas d'animation infinie, peu d'ombres et rendu
   différé des cartes hors écran.
   ========================================================================== */

body.pg-collection {
    --pg-bg: #080b10;
    --pg-surface: #111722;
    --pg-surface-soft: #171e2a;
    --pg-surface-muted: #0d121b;
    --pg-border: #293241;
    --pg-border-soft: #202938;
    --pg-text: #f5f7fb;
    --pg-muted: #9da8b8;
    --pg-gold: #f4c84a;
    --pg-blue: #65b7ff;
    --pg-green: #52d68a;
    --pg-orange: #ff9b50;
    --pg-red: #ff6b67;
    --pg-purple: #b79cff;
    --pg-radius: 16px;
    min-height: 100vh;
    margin: 0;
    padding: 24px;
    overflow-x: hidden;
    background: #080b10 !important;
    color: var(--pg-text);
    font-family: "Poppins", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

/* Pas de transition globale du fond pendant le mode transfert. */
body.pg-collection {
    transition: none !important;
}

body.pg-collection *,
body.pg-collection *::before,
body.pg-collection *::after {
    box-sizing: border-box;
}

body.pg-collection .container {
    width: min(100%, 1540px);
    max-width: 1540px;
    margin: 0 auto;
}

/* ==========================================================================
   EN-TÊTE
   ========================================================================== */

body.pg-collection .header {
    display: grid !important;
    grid-template-columns: minmax(210px, .75fr) minmax(520px, 2.25fr) minmax(210px, .75fr);
    align-items: stretch !important;
    gap: 18px;
    margin: 0 0 24px;
    padding: 18px;
    overflow: visible;
    border: 1px solid #5a4d24;
    border-radius: 20px;
    background: #101620 !important;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .22);
}

body.pg-collection .header > div:first-child {
    display: flex !important;
    width: auto !important;
    height: auto !important;
    min-height: 100%;
    flex: none !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 18px 14px !important;
    border: 1px solid var(--pg-border);
    border-radius: var(--pg-radius);
    background: var(--pg-surface-muted);
}

body.pg-collection .header > div:first-child h1 {
    margin: 0 !important;
    color: var(--pg-text);
    font-size: clamp(22px, 2vw, 30px) !important;
    line-height: 1.1;
    overflow-wrap: anywhere;
}

body.pg-collection .header > div:first-child h1 + div {
    margin-top: 10px;
    color: var(--pg-gold) !important;
    font-size: 15px !important;
}

body.pg-collection .stats-container {
    display: grid !important;
    grid-template-columns: repeat(4, minmax(100px, 1fr)) !important;
    align-content: stretch;
    gap: 10px !important;
    width: auto !important;
    margin: 0 !important;
}

body.pg-collection .stat-item {
    min-height: 72px;
    padding: 12px 10px !important;
    border: 1px solid var(--pg-border) !important;
    border-radius: 13px !important;
    background: var(--pg-surface-soft) !important;
    box-shadow: none !important;
    transition: border-color 120ms ease, background-color 120ms ease;
}

body.pg-collection .stat-item:hover {
    border-color: #665a31 !important;
    background: #1c2431 !important;
}

body.pg-collection .stat-label {
    margin-bottom: 4px;
    color: var(--pg-muted) !important;
    font-size: 9px !important;
    letter-spacing: .6px;
}

body.pg-collection .stat-value {
    color: var(--pg-text) !important;
    font-size: clamp(16px, 1.35vw, 20px) !important;
}

body.pg-collection .header-actions {
    display: grid !important;
    grid-template-columns: 1fr !important;
    align-content: center;
    gap: 7px !important;
    min-width: 0 !important;
    margin: 0 !important;
    padding: 10px;
    border: 1px solid var(--pg-border);
    border-radius: var(--pg-radius);
    background: var(--pg-surface-muted);
}

/* ==========================================================================
   SECTIONS ET OUTILS
   ========================================================================== */

body.pg-collection .section-wrapper {
    margin: 0 0 18px;
    overflow: hidden;
    border: 1px solid var(--pg-border-soft);
    border-radius: 18px;
    background: #0e141e;
    box-shadow: 0 5px 18px rgba(0, 0, 0, .16);
}

body.pg-collection .section-header {
    min-height: 68px;
    margin: 0 !important;
    padding: 15px 18px !important;
    border: 0 !important;
    border-left: 4px solid var(--pg-gold) !important;
    border-radius: 0 !important;
    background: #151c27 !important;
    transition: background-color 120ms ease;
}

body.pg-collection .section-header:hover {
    background: #192231 !important;
}

body.pg-collection .section-title {
    margin: 0 !important;
    color: var(--pg-text) !important;
    font-size: clamp(16px, 1.4vw, 20px) !important;
    text-transform: none !important;
}

body.pg-collection .section-icon,
body.pg-collection .pokedex-region-icon {
    display: grid;
    width: 32px;
    height: 32px;
    flex: 0 0 32px;
    place-items: center;
    border: 1px solid var(--pg-border);
    border-radius: 50%;
    background: #0e141e;
    color: var(--pg-gold);
    font-size: 13px !important;
    transition: transform 120ms ease !important;
}

/* Une section fermée ne participe plus au layout ni au rendu. */
body.pg-collection .collapsible-content {
    display: block;
    max-height: none !important;
    padding: 0 16px 16px;
    overflow: visible !important;
    opacity: 1 !important;
    transition: none !important;
}

body.pg-collection .section-wrapper.is-closed > .collapsible-content {
    display: none !important;
}

body.pg-collection .sort-bar,
body.pg-collection .pokedex-search-bar {
    margin: 14px 0 2px !important;
    padding: 12px !important;
    border: 1px solid var(--pg-border-soft) !important;
    border-radius: 12px !important;
    background: #111823 !important;
}

body.pg-collection .btn-sort {
    min-height: 32px;
    padding: 6px 10px !important;
    border: 1px solid var(--pg-border) !important;
    border-radius: 8px !important;
    background: #151d29 !important;
    color: var(--pg-muted) !important;
    font-size: 9px !important;
    transition: background-color 100ms ease, color 100ms ease, border-color 100ms ease !important;
}

body.pg-collection .btn-sort:hover {
    border-color: #665a31 !important;
    color: var(--pg-text) !important;
    background: #1a2432 !important;
}

body.pg-collection .btn-sort.active {
    border-color: var(--pg-gold) !important;
    background: var(--pg-gold) !important;
    color: #111 !important;
}

body.pg-collection .pokedex-search-input,
body.pg-collection #teamSearch {
    width: min(100%, 340px) !important;
    min-height: 40px;
    padding: 8px 11px !important;
    outline: 0;
    border: 1px solid var(--pg-border) !important;
    border-radius: 9px !important;
    background: #0b1018 !important;
    color: var(--pg-text) !important;
    font-size: 11px !important;
}

/* ==========================================================================
   GRILLES ET CARTES
   ========================================================================== */

body.pg-collection .grid {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)) !important;
    gap: 12px !important;
    padding: 14px 0 2px !important;
}

body.pg-collection .pokemon-card {
    min-height: 330px !important;
    padding: 14px !important;
    overflow: hidden;
    border: 1px solid var(--pg-border) !important;
    border-radius: 14px !important;
    background: var(--pg-surface) !important;
    box-shadow: none !important;
    transition: border-color 100ms ease, background-color 100ms ease !important;

    /* Gain majeur sur les longues listes : les cartes hors écran ne sont
       dessinées qu'à l'approche du viewport. */
    content-visibility: auto;
    contain-intrinsic-size: 330px 190px;
}

body.pg-collection .pokemon-card::before,
body.pg-collection .pokemon-card::after {
    content: none !important;
}

body.pg-collection .pokemon-card:hover {
    z-index: auto;
    transform: none !important;
    border-color: #665a31 !important;
    background: #141c28 !important;
    box-shadow: none !important;
}

body.pg-collection .pokemon-card img,
body.pg-collection .card-front img,
body.pg-collection .card-back img {
    width: 100px !important;
    height: 100px !important;
    object-fit: contain;
    image-rendering: pixelated;
    filter: none !important;
}

body.pg-collection .card-inner {
    height: 104px !important;
    margin: 2px 0 4px;
    transition: transform 260ms ease !important;
}

body.pg-collection .pokemon-id {
    top: 9px !important;
    right: 9px !important;
    padding: 3px 6px;
    border: 1px solid var(--pg-border);
    border-radius: 999px;
    background: #0a0f17;
    color: var(--pg-gold) !important;
    font-size: 9px !important;
}

body.pg-collection .pokemon-name {
    margin: 6px 0 3px !important;
    color: var(--pg-text);
    font-size: 13px !important;
    font-weight: 800 !important;
    line-height: 1.2;
}

body.pg-collection .pokemon-traits {
    gap: 4px !important;
    margin: 6px 0 7px !important;
}

body.pg-collection .trait-badge {
    min-height: 21px !important;
    padding: 3px 7px !important;
    font-size: 8px !important;
    box-shadow: none !important;
}

body.pg-collection .archetype-badge {
    min-height: 25px !important;
    padding: 4px 10px !important;
    background: #0b1018 !important;
    font-size: 10px !important;
    letter-spacing: .38px !important;
}

body.pg-collection .btn-sort-shiny {
    border-color: rgba(255, 168, 76, .55) !important;
    color: #ffbd73 !important;
}

body.pg-collection .btn-sort-shiny:hover,
body.pg-collection .btn-sort-shiny.active {
    border-color: #ffad55 !important;
    background: #ffad55 !important;
    color: #15100a !important;
}

body.pg-collection .hp-text {
    color: #cbd3df !important;
    font-size: 10px !important;
}

body.pg-collection .hp-bar,
body.pg-collection .xp-bar-container {
    height: 6px !important;
    margin: 6px 0 !important;
    border: 0 !important;
    border-radius: 999px !important;
    background: #070a0f !important;
    box-shadow: none !important;
}

body.pg-collection .hp-fill {
    border-radius: inherit;
    background: #52d68a !important;
    transition: width 180ms linear !important;
}

body.pg-collection .xp-bar-fill {
    border-radius: inherit;
    background: #65b7ff !important;
    transition: width 180ms linear !important;
}

body.pg-collection .history-info,
body.pg-collection .pokedex-meta {
    margin-top: 8px !important;
    padding: 8px !important;
    border: 1px solid var(--pg-border-soft) !important;
    border-radius: 10px !important;
    background: #0b1018 !important;
    color: var(--pg-muted);
}

body.pg-collection .action-area,
body.pg-collection .pokedex-actions {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
    margin-top: auto;
    padding-top: 8px;
}

body.pg-collection .btn-card,
body.pg-collection .desc-btn,
body.pg-collection .cry-btn {
    width: 100% !important;
    min-height: 32px;
    margin: 0 !important;
    padding: 6px 7px !important;
    border-width: 1px !important;
    border-radius: 8px !important;
    background: #121923 !important;
    font-size: 8px !important;
    box-shadow: none !important;
    transition: background-color 100ms ease, color 100ms ease !important;
}

body.pg-collection .btn-card:hover,
body.pg-collection .desc-btn:hover,
body.pg-collection .cry-btn:hover {
    transform: none !important;
}

body.pg-collection .btn-up { color: var(--pg-blue) !important; border-color: #376b96 !important; }
body.pg-collection .btn-transfer { color: var(--pg-red) !important; border-color: #874543 !important; }
body.pg-collection .btn-fav { color: var(--pg-gold) !important; border-color: #78672d !important; }
body.pg-collection .btn-fav-remove { color: var(--pg-orange) !important; border-color: #8c572e !important; }

body.pg-collection .btn-evolve-ready {
    grid-column: 1 / -1;
    color: #171204 !important;
    border-color: var(--pg-gold) !important;
    background: var(--pg-gold) !important;
    animation: none !important;
    box-shadow: none !important;
}

/* ==========================================================================
   ÉTATS SPÉCIAUX — TOUS STATIQUES
   ========================================================================== */

body.pg-collection .pokemon-card.favorite-glow {
    border-color: #8b7430 !important;
    box-shadow: inset 0 0 0 1px rgba(244, 200, 74, .18) !important;
}

body.pg-collection .pokemon-card.shiny-card {
    border-color: #a95835 !important;
    background: #1b1717 !important;
    animation: none !important;
    box-shadow: inset 0 0 0 1px rgba(255, 122, 65, .16) !important;
}

body.pg-collection .pokemon-card.pokedex-complete {
    border-color: #6d7888 !important;
    box-shadow: inset 0 0 0 1px rgba(220, 228, 240, .12) !important;
}

body.pg-collection .pokemon-card.archived {
    opacity: .72 !important;
    filter: none !important;
    border-style: dashed !important;
    background: #0c1119 !important;
}

body.pg-collection .pokemon-card.archived:hover {
    opacity: .9 !important;
}

body.pg-collection .pokemon-card.locked-box {
    opacity: .72 !important;
    border-color: #695995 !important;
    box-shadow: none !important;
}

body.pg-collection .breed-badge.can-breed {
    box-shadow: none !important;
}

body.pg-collection .box-lock-badge,
body.pg-collection .breed-badge {
    background: #090e16 !important;
    backdrop-filter: none !important;
}

body.pg-collection .not-owned {
    opacity: .42 !important;
    filter: none !important;
}

body.pg-collection .not-owned img {
    opacity: .13;
    filter: none !important;
}

/* ==========================================================================
   POKÉDEX PAR RÉGION
   ========================================================================== */

body.pg-collection .pokedex-region-wrapper {
    margin-top: 14px;
    overflow: hidden;
    border: 1px solid var(--pg-border-soft);
    border-radius: 14px;
    background: #0b1119;
}

body.pg-collection .pokedex-region-header {
    min-height: 54px;
    margin: 0 !important;
    padding: 11px 14px !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: #141b26 !important;
}

body.pg-collection .pokedex-region-title {
    color: var(--pg-text);
    font-size: 13px;
}

body.pg-collection .pokedex-region-content {
    display: block;
    max-height: none !important;
    padding: 0 12px 12px;
    overflow: visible !important;
    opacity: 1 !important;
    transition: none !important;
}

body.pg-collection .pokedex-region-wrapper.is-closed > .pokedex-region-content {
    display: none !important;
}

body.pg-collection #section-pokedex .grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)) !important;
    gap: 10px !important;
}

body.pg-collection #section-pokedex .pokemon-card {
    min-height: 270px !important;
    padding: 12px !important;
    contain-intrinsic-size: 270px 160px;
}

body.pg-collection #section-pokedex .pokemon-card img,
body.pg-collection #section-pokedex .card-front img,
body.pg-collection #section-pokedex .card-back img {
    width: 88px !important;
    height: 88px !important;
}

body.pg-collection #section-pokedex .card-inner {
    height: 92px !important;
}

/* ==========================================================================
   MODALES
   ========================================================================== */

body.pg-collection .modal,
body.pg-collection #healModal,
body.pg-collection #descModal {
    padding: 18px !important;
    background: rgba(3, 5, 8, .88) !important;
    backdrop-filter: none !important;
}

body.pg-collection .modal-content,
body.pg-collection #healContent,
body.pg-collection #descModalContent {
    width: min(100%, 540px) !important;
    max-height: min(86vh, 760px);
    padding: 20px !important;
    overflow-y: auto;
    border: 1px solid #665a31 !important;
    border-radius: 16px !important;
    background: #111722 !important;
    box-shadow: 0 16px 48px rgba(0, 0, 0, .46) !important;
}

/* ==========================================================================
   MODE TRANSFERT
   ========================================================================== */

body.pg-collection.transfer-mode {
    background: #08090d !important;
}

body.pg-collection.transfer-mode #toggleTransfer {
    border-color: #fff !important;
    background: var(--pg-red) !important;
    color: #111 !important;
    animation: none !important;
}

body.pg-collection.transfer-mode .pokemon-card.selected {
    transform: none !important;
    border: 2px solid var(--pg-red) !important;
    background: #261417 !important;
}

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */

@media (max-width: 1280px) {
    body.pg-collection .header {
        grid-template-columns: 210px 1fr;
    }

    body.pg-collection .header-actions {
        grid-column: 1 / -1;
        grid-template-columns: repeat(4, minmax(115px, 1fr)) !important;
    }
}

@media (max-width: 980px) {
    body.pg-collection {
        padding: 16px;
    }

    body.pg-collection .header {
        grid-template-columns: 1fr !important;
    }

    body.pg-collection .stats-container {
        grid-template-columns: repeat(4, minmax(85px, 1fr)) !important;
    }

    body.pg-collection .header-actions {
        grid-column: auto;
        grid-template-columns: repeat(3, minmax(105px, 1fr)) !important;
    }

    body.pg-collection .grid {
        grid-template-columns: repeat(auto-fill, minmax(178px, 1fr)) !important;
    }
}

@media (max-width: 700px) {
    body.pg-collection {
        padding: 8px;
    }

    body.pg-collection .header {
        gap: 10px;
        padding: 10px;
        border-radius: 15px;
    }

    body.pg-collection .stats-container {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }

    body.pg-collection .header-actions {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }

    body.pg-collection .section-wrapper {
        border-radius: 14px;
    }

    body.pg-collection .collapsible-content {
        padding-right: 8px;
        padding-left: 8px;
    }

    body.pg-collection .grid,
    body.pg-collection #section-pokedex .grid {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 8px !important;
    }

    body.pg-collection .pokemon-card,
    body.pg-collection #section-pokedex .pokemon-card {
        min-height: 300px !important;
        padding: 10px !important;
    }

    body.pg-collection .pokemon-card img,
    body.pg-collection .card-front img,
    body.pg-collection .card-back img,
    body.pg-collection #section-pokedex .pokemon-card img,
    body.pg-collection #section-pokedex .card-front img,
    body.pg-collection #section-pokedex .card-back img {
        width: 80px !important;
        height: 80px !important;
    }

    body.pg-collection .card-inner,
    body.pg-collection #section-pokedex .card-inner {
        height: 84px !important;
    }

    body.pg-collection .pokemon-name {
        font-size: 11px !important;
    }

    body.pg-collection .trait-badge {
        min-height: 19px !important;
        padding: 3px 5px !important;
        font-size: 7px !important;
    }

    body.pg-collection .archetype-badge {
        min-height: 22px !important;
        padding: 4px 7px !important;
        font-size: 8px !important;
    }

    body.pg-collection .action-area,
    body.pg-collection .pokedex-actions {
        grid-template-columns: 1fr;
    }

    body.pg-collection .btn-evolve-ready {
        grid-column: auto;
    }

    body.pg-collection .modal,
    body.pg-collection #healModal,
    body.pg-collection #descModal {
        padding: 8px !important;
    }
}

@media (max-width: 420px) {
    body.pg-collection .header-actions,
    body.pg-collection .grid,
    body.pg-collection #section-pokedex .grid {
        grid-template-columns: 1fr !important;
    }

    body.pg-collection .pokemon-card,
    body.pg-collection #section-pokedex .pokemon-card {
        min-height: 0 !important;
    }
}

@media (prefers-reduced-motion: reduce) {
    body.pg-collection *,
    body.pg-collection *::before,
    body.pg-collection *::after {
        scroll-behavior: auto !important;
        animation: none !important;
        transition: none !important;
    }
}

/* ========================================================================== 
   RESPONSIVE V2 — MOBILE / TABLETTE
   Objectif : densité utile sans sacrifier la lisibilité.
   ========================================================================== */

/* Tablettes horizontales et petits laptops : davantage de cartes visibles. */
@media (min-width: 821px) and (max-width: 1100px) {
    body.pg-collection {
        padding: 12px !important;
    }

    body.pg-collection .header {
        grid-template-columns: 190px minmax(0, 1fr) !important;
        gap: 12px !important;
        padding: 12px !important;
    }

    body.pg-collection .header-actions {
        grid-column: 1 / -1 !important;
        grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
        padding: 8px !important;
    }

    body.pg-collection .grid,
    body.pg-collection #section-pokedex .grid {
        grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
        gap: 10px !important;
    }

    body.pg-collection .pokemon-card {
        min-height: 310px !important;
        padding: 11px !important;
    }
}

/* Tablettes verticales : trois cartes confortables par ligne. */
@media (min-width: 621px) and (max-width: 820px) {
    body.pg-collection {
        padding: 10px !important;
    }

    body.pg-collection .header {
        grid-template-columns: 1fr !important;
        gap: 10px !important;
        padding: 11px !important;
    }

    body.pg-collection .header > div:first-child {
        min-height: 92px !important;
        padding: 11px !important;
    }

    body.pg-collection .stats-container {
        grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
        gap: 7px !important;
    }

    body.pg-collection .stat-item {
        min-height: 60px !important;
        padding: 8px 6px !important;
    }

    body.pg-collection .header-actions {
        grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
        padding: 8px !important;
    }

    body.pg-collection .grid,
    body.pg-collection #section-pokedex .grid {
        grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
        gap: 9px !important;
    }

    body.pg-collection .pokemon-card,
    body.pg-collection #section-pokedex .pokemon-card {
        min-height: 292px !important;
        padding: 10px !important;
    }

    body.pg-collection .pokemon-card img,
    body.pg-collection .card-front img,
    body.pg-collection .card-back img,
    body.pg-collection #section-pokedex .pokemon-card img,
    body.pg-collection #section-pokedex .card-front img,
    body.pg-collection #section-pokedex .card-back img {
        width: 78px !important;
        height: 78px !important;
    }

    body.pg-collection .card-inner,
    body.pg-collection #section-pokedex .card-inner {
        height: 82px !important;
    }
}

/* Téléphones : toujours deux cartes. */
@media (max-width: 620px) {
    body.pg-collection {
        padding: 5px !important;
    }

    body.pg-collection .container {
        width: 100% !important;
    }

    body.pg-collection .header {
        grid-template-columns: 1fr !important;
        gap: 7px !important;
        margin-bottom: 10px !important;
        padding: 7px !important;
        border-radius: 13px !important;
    }

    body.pg-collection .header > div:first-child {
        min-height: 68px !important;
        padding: 8px !important;
        border-radius: 10px !important;
    }

    body.pg-collection .header > div:first-child h1 {
        font-size: 19px !important;
    }

    body.pg-collection .header > div:first-child h1 + div {
        margin-top: 4px !important;
        font-size: 13px !important;
    }

    body.pg-collection .stats-container {
        grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
        gap: 5px !important;
    }

    body.pg-collection .stat-item {
        min-height: 52px !important;
        padding: 6px 3px !important;
        border-radius: 9px !important;
    }

    body.pg-collection .stat-label {
        margin-bottom: 2px !important;
        font-size: 6.8px !important;
        letter-spacing: .15px !important;
        line-height: 1.15 !important;
    }

    body.pg-collection .stat-value {
        font-size: 13px !important;
    }

    body.pg-collection .header-actions {
        grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
        gap: 5px !important;
        padding: 6px !important;
        border-radius: 10px !important;
    }

    body.pg-collection .section-wrapper {
        margin-bottom: 9px !important;
        border-radius: 12px !important;
    }

    body.pg-collection .section-header {
        min-height: 50px !important;
        padding: 10px 10px !important;
        border-left-width: 3px !important;
    }

    body.pg-collection .section-title {
        font-size: 13px !important;
        line-height: 1.2 !important;
    }

    body.pg-collection .section-icon,
    body.pg-collection .pokedex-region-icon {
        width: 27px !important;
        height: 27px !important;
        flex-basis: 27px !important;
        font-size: 11px !important;
    }

    body.pg-collection .collapsible-content {
        padding: 0 6px 7px !important;
    }

    body.pg-collection .sort-bar,
    body.pg-collection .pokedex-search-bar {
        margin-top: 7px !important;
        padding: 7px !important;
        gap: 5px !important;
        border-radius: 9px !important;
    }

    body.pg-collection .btn-sort {
        min-height: 28px !important;
        padding: 4px 6px !important;
        font-size: 7px !important;
    }

    body.pg-collection #teamSearch,
    body.pg-collection .pokedex-search-input {
        width: 100% !important;
        min-height: 34px !important;
        font-size: 9px !important;
    }

    body.pg-collection .grid,
    body.pg-collection #section-pokedex .grid {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 6px !important;
        padding: 7px 0 1px !important;
    }

    body.pg-collection .pokemon-card,
    body.pg-collection #section-pokedex .pokemon-card {
        min-width: 0 !important;
        min-height: 270px !important;
        padding: 7px !important;
        border-radius: 10px !important;
        contain-intrinsic-size: 270px 145px !important;
    }

    body.pg-collection .pokemon-card img,
    body.pg-collection .card-front img,
    body.pg-collection .card-back img,
    body.pg-collection #section-pokedex .pokemon-card img,
    body.pg-collection #section-pokedex .card-front img,
    body.pg-collection #section-pokedex .card-back img {
        width: 68px !important;
        height: 68px !important;
    }

    body.pg-collection .card-inner,
    body.pg-collection #section-pokedex .card-inner {
        height: 72px !important;
        margin-bottom: 1px !important;
    }

    body.pg-collection .pokemon-id {
        top: 5px !important;
        right: 5px !important;
        padding: 2px 4px !important;
        font-size: 7px !important;
    }

    body.pg-collection .breed-badge {
        top: 5px !important;
        left: 5px !important;
        width: 22px !important;
        height: 22px !important;
        font-size: 11px !important;
    }

    body.pg-collection .box-lock-badge {
        top: 5px !important;
        right: 5px !important;
        padding: 3px 5px !important;
        font-size: 7px !important;
    }

    body.pg-collection .pokemon-name {
        min-height: 25px !important;
        margin: 3px 0 2px !important;
        font-size: 9.5px !important;
        line-height: 1.15 !important;
    }

    body.pg-collection .pokemon-traits {
        gap: 3px !important;
        margin: 3px 0 4px !important;
        min-height: 0 !important;
    }

    body.pg-collection .trait-badge {
        min-width: 0 !important;
        min-height: 18px !important;
        padding: 2px 4px !important;
        font-size: 6.4px !important;
        letter-spacing: 0 !important;
    }

    body.pg-collection .type-badge {
        flex: 1 1 46%;
    }

    body.pg-collection .archetype-badge {
        flex: 1 0 100% !important;
        min-height: 21px !important;
        padding: 3px 5px !important;
        font-size: 7.6px !important;
    }

    body.pg-collection .hp-text,
    body.pg-collection .pokemon-card > div[style*="font-size: 10px"] {
        font-size: 8px !important;
    }

    body.pg-collection .hp-bar,
    body.pg-collection .xp-bar-container {
        height: 5px !important;
        margin: 4px 0 !important;
    }

    body.pg-collection .history-info,
    body.pg-collection .pokedex-meta {
        margin-top: 5px !important;
        padding: 5px !important;
        border-radius: 7px !important;
        font-size: 7.5px !important;
    }

    body.pg-collection .history-info .date-line,
    body.pg-collection .history-info .status-line,
    body.pg-collection .pokedex-meta {
        font-size: 7.5px !important;
    }

    body.pg-collection .action-area,
    body.pg-collection .pokedex-actions {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 4px !important;
        padding-top: 5px !important;
    }

    body.pg-collection .btn-card,
    body.pg-collection .desc-btn,
    body.pg-collection .cry-btn {
        min-height: 27px !important;
        padding: 4px 3px !important;
        border-radius: 6px !important;
        font-size: 6.5px !important;
        line-height: 1.1 !important;
    }

    body.pg-collection .btn-evolve-ready {
        grid-column: 1 / -1 !important;
    }

    body.pg-collection .pokedex-region-wrapper {
        margin-top: 7px !important;
        border-radius: 10px !important;
    }

    body.pg-collection .pokedex-region-header {
        min-height: 44px !important;
        padding: 8px 9px !important;
    }

    body.pg-collection .pokedex-region-title {
        font-size: 11px !important;
    }

    body.pg-collection .pokedex-region-content {
        padding: 0 5px 5px !important;
    }

    body.pg-collection #section-pokedex .pokemon-card {
        min-height: 238px !important;
    }
}

/* Même les écrans de 320–420 px conservent deux colonnes. */
@media (max-width: 420px) {
    body.pg-collection .grid,
    body.pg-collection #section-pokedex .grid {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }

    body.pg-collection .header-actions {
        grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    }
}

@media (max-width: 350px) {
    body.pg-collection .stats-container {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }

    body.pg-collection .header-actions {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }

    body.pg-collection .pokemon-card,
    body.pg-collection #section-pokedex .pokemon-card {
        padding: 6px !important;
    }
}

/* ========================================================================== 
   RESTAURATION DES AURAS — version performante
   Les effets restent statiques sur mobile/tablette et le shiny ne pulse que
   sur ordinateur afin de préserver la fluidité des longues grilles.
   ========================================================================== */

body.pg-collection .pokemon-card.favorite-glow {
    border-color: #e6be35 !important;
    box-shadow:
        0 0 0 1px rgba(245, 197, 66, .34),
        0 0 13px rgba(245, 197, 66, .42) !important;
}

body.pg-collection .pokemon-card.shiny-card {
    border-color: #ff4b2e !important;
    background:
        linear-gradient(180deg, rgba(255, 72, 38, .08), transparent 45%),
        #1b1516 !important;
    animation: none !important;
    box-shadow:
        0 0 0 1px rgba(255, 87, 48, .44),
        0 0 14px rgba(255, 58, 32, .58),
        0 0 25px rgba(255, 35, 20, .22) !important;
}

body.pg-collection .pokemon-card.pokedex-complete {
    border-color: #d7dee8 !important;
    box-shadow:
        0 0 0 1px rgba(226, 233, 242, .36),
        0 0 13px rgba(210, 220, 234, .48),
        0 0 22px rgba(196, 207, 224, .18) !important;
}

/* Un favori shiny conserve l'aura rouge, avec un liseré doré intérieur. */
body.pg-collection .pokemon-card.favorite-glow.shiny-card {
    border-color: #ff5a34 !important;
    box-shadow:
        inset 0 0 0 2px rgba(245, 197, 66, .48),
        0 0 14px rgba(255, 58, 32, .62),
        0 0 25px rgba(255, 35, 20, .24) !important;
}

/* Le pulse reste limité aux rares cartes shiny et uniquement sur PC. */
@keyframes pg-shiny-aura-pulse {
    0%, 100% {
        box-shadow:
            0 0 0 1px rgba(255, 87, 48, .40),
            0 0 12px rgba(255, 58, 32, .48),
            0 0 21px rgba(255, 35, 20, .18);
    }
    50% {
        box-shadow:
            0 0 0 1px rgba(255, 115, 58, .58),
            0 0 18px rgba(255, 72, 32, .72),
            0 0 30px rgba(255, 35, 20, .28);
    }
}

@media (min-width: 1025px) and (prefers-reduced-motion: no-preference) {
    body.pg-collection .pokemon-card.shiny-card:not(.favorite-glow) {
        animation: pg-shiny-aura-pulse 2.8s ease-in-out infinite !important;
    }
}

/* Sur téléphone/tablette, halos plus courts pour éviter les chevauchements. */
@media (max-width: 1024px) {
    body.pg-collection .pokemon-card.favorite-glow {
        box-shadow:
            0 0 0 1px rgba(245, 197, 66, .34),
            0 0 8px rgba(245, 197, 66, .38) !important;
    }

    body.pg-collection .pokemon-card.shiny-card {
        animation: none !important;
        box-shadow:
            0 0 0 1px rgba(255, 87, 48, .42),
            0 0 9px rgba(255, 58, 32, .54),
            0 0 15px rgba(255, 35, 20, .18) !important;
    }

    body.pg-collection .pokemon-card.pokedex-complete {
        box-shadow:
            0 0 0 1px rgba(226, 233, 242, .34),
            0 0 8px rgba(210, 220, 234, .43),
            0 0 14px rgba(196, 207, 224, .14) !important;
    }

    body.pg-collection .pokemon-card.favorite-glow.shiny-card {
        box-shadow:
            inset 0 0 0 2px rgba(245, 197, 66, .45),
            0 0 9px rgba(255, 58, 32, .58),
            0 0 15px rgba(255, 35, 20, .18) !important;
    }
}

/* Les entrées Pokédex qui possèdent au moins un shiny reprennent aussi l'aura rouge. */
body.pg-collection .pokemon-card.pokedex-card[data-shiny="1"] {
    border-color: #ff4b2e !important;
    background:
        linear-gradient(180deg, rgba(255, 72, 38, .08), transparent 45%),
        #1b1516 !important;
    box-shadow:
        0 0 0 1px rgba(255, 87, 48, .44),
        0 0 14px rgba(255, 58, 32, .58),
        0 0 25px rgba(255, 35, 20, .22) !important;
}

/* Shiny + Pokédex complet : liseré argenté et halo rouge. */
body.pg-collection .pokemon-card.pokedex-card.pokedex-complete[data-shiny="1"] {
    border-color: #ff5a34 !important;
    box-shadow:
        inset 0 0 0 2px rgba(220, 228, 240, .52),
        0 0 14px rgba(255, 58, 32, .62),
        0 0 25px rgba(255, 35, 20, .24) !important;
}

@media (min-width: 1025px) and (prefers-reduced-motion: no-preference) {
    body.pg-collection .pokemon-card.pokedex-card[data-shiny="1"]:not(.pokedex-complete) {
        animation: pg-shiny-aura-pulse 2.8s ease-in-out infinite !important;
    }
}

@media (max-width: 1024px) {
    body.pg-collection .pokemon-card.pokedex-card[data-shiny="1"] {
        animation: none !important;
        box-shadow:
            0 0 0 1px rgba(255, 87, 48, .42),
            0 0 9px rgba(255, 58, 32, .54),
            0 0 15px rgba(255, 35, 20, .18) !important;
    }

    body.pg-collection .pokemon-card.pokedex-card.pokedex-complete[data-shiny="1"] {
        box-shadow:
            inset 0 0 0 2px rgba(220, 228, 240, .48),
            0 0 9px rgba(255, 58, 32, .58),
            0 0 15px rgba(255, 35, 20, .18) !important;
    }
}


/* =========================================================
   Badges d'arènes dans l'en-tête du Pokédex
========================================================= */
body.pg-collection .collection-player-summary{
    display:flex;
    flex-direction:column;
    justify-content:center;
    align-items:center;
    width:100%;
}

body.pg-collection .collection-player-xp{
    margin-top:10px;
    color:var(--pg-gold);
    font-size:15px;
    font-weight:800;
}

body.pg-collection .collection-arena-badges{
    display:grid;
    grid-template-columns:repeat(5, 34px);
    grid-template-rows:repeat(2, 34px);
    justify-content:center;
    gap:5px 6px;
    margin-top:14px;
}

body.pg-collection .collection-arena-badge{
    display:grid;
    width:34px;
    height:34px;
    place-items:center;
    border-radius:50%;
    transition:transform .16s ease, opacity .16s ease;
}

body.pg-collection .collection-arena-badge img{
    display:block;
    width:32px;
    height:32px;
    object-fit:contain;
}

body.pg-collection .collection-arena-badge.is-unlocked img{
    filter:none;
    opacity:1;
}

body.pg-collection .collection-arena-badge.is-locked img{
    filter:grayscale(1) brightness(.18) contrast(1.25);
    opacity:.58;
}

body.pg-collection .collection-arena-badge:hover{
    transform:translateY(-2px) scale(1.08);
}

@media(max-width:720px){
    body.pg-collection .collection-arena-badges{
        grid-template-columns:repeat(5, 30px);
        grid-template-rows:repeat(2, 30px);
        gap:4px 5px;
        margin-top:10px;
    }

    body.pg-collection .collection-arena-badge{
        width:30px;
        height:30px;
    }

    body.pg-collection .collection-arena-badge img{
        width:28px;
        height:28px;
    }
}

/* ========================================================================== 
   AVATAR CHAT TWITCH — favori 6 + 1
   ========================================================================== */
body.pg-collection .chat-avatar-slot {
    position: relative;
    min-height: 330px;
    padding: 14px;
    overflow: visible;
    border: 1px solid rgba(113, 220, 255, .42);
    border-radius: 14px;
    background:
        linear-gradient(180deg, rgba(20, 168, 255, .08), transparent 50%),
        #0d151f;
    box-shadow:
        inset 0 0 0 1px rgba(20, 168, 255, .10),
        0 0 18px rgba(20, 168, 255, .08);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    text-align: center;
}

body.pg-collection .chat-avatar-slot.has-avatar {
    border-color: rgba(113, 220, 255, .65);
    box-shadow:
        inset 0 0 0 1px rgba(113, 220, 255, .18),
        0 0 16px rgba(20, 168, 255, .22);
}

body.pg-collection .chat-avatar-slot-head {
    width: 100%;
    min-height: 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
}

body.pg-collection .chat-avatar-kicker {
    color: #71dcff;
    font-size: 10px;
    font-weight: 900;
    letter-spacing: .08em;
    text-transform: uppercase;
}

body.pg-collection .chat-avatar-info {
    position: relative;
    display: inline-grid;
    width: 24px;
    height: 24px;
    place-items: center;
    flex: 0 0 24px;
    border: 1px solid rgba(113, 220, 255, .35);
    border-radius: 50%;
    color: #71dcff;
    background: #111b27;
    cursor: help;
    font-size: 14px;
    outline: none;
}

body.pg-collection .chat-avatar-tooltip {
    position: absolute;
    z-index: 30;
    top: 30px;
    right: 0;
    width: min(250px, 72vw);
    padding: 9px 10px;
    border: 1px solid rgba(113, 220, 255, .35);
    border-radius: 9px;
    background: #07101a;
    color: #eaf7ff;
    font-size: 10px;
    font-weight: 700;
    line-height: 1.35;
    text-align: left;
    box-shadow: 0 10px 28px rgba(0, 0, 0, .42);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-4px);
    pointer-events: none;
    transition: opacity 120ms ease, transform 120ms ease, visibility 120ms ease;
}

body.pg-collection .chat-avatar-info:hover .chat-avatar-tooltip,
body.pg-collection .chat-avatar-info:focus .chat-avatar-tooltip,
body.pg-collection .chat-avatar-info:focus-within .chat-avatar-tooltip {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

body.pg-collection .chat-avatar-sprite {
    width: 118px !important;
    height: 118px !important;
    margin: 8px auto 6px;
    object-fit: contain;
    image-rendering: pixelated;
    filter: drop-shadow(0 0 11px rgba(113, 220, 255, .24));
}

body.pg-collection .chat-avatar-egg {
    image-rendering: auto;
    filter: drop-shadow(0 0 12px rgba(244, 201, 63, .20));
}

body.pg-collection .chat-avatar-name {
    color: #f7fbff;
    font-size: 13px;
    font-weight: 900;
}

body.pg-collection .chat-avatar-meta {
    display: block;
    min-height: 34px;
    margin: 6px 0 10px;
    color: #9fb8cc;
    font-size: 9px;
    font-weight: 700;
    line-height: 1.35;
}

body.pg-collection .btn-chat-avatar {
    color: #71dcff !important;
    border-color: #347896 !important;
}

body.pg-collection .btn-chat-avatar:hover:not(:disabled) {
    background: #17364a !important;
    color: #f7fbff !important;
}

body.pg-collection .btn-chat-avatar.is-active,
body.pg-collection .btn-chat-avatar:disabled {
    color: #081017 !important;
    border-color: #71dcff !important;
    background: #71dcff !important;
    opacity: 1 !important;
    cursor: default !important;
}

body.pg-collection .btn-chat-avatar-reset {
    margin-top: auto !important;
    color: #f4c93f !important;
    border-color: #7e6c2d !important;
}

body.pg-collection .pokemon-card.chat-avatar-selected {
    border-color: #71dcff !important;
    box-shadow:
        inset 0 0 0 2px rgba(113, 220, 255, .32),
        0 0 14px rgba(20, 168, 255, .40) !important;
}

body.pg-collection .pokemon-card.chat-avatar-selected.shiny-card {
    border-color: #71dcff !important;
    box-shadow:
        inset 0 0 0 2px rgba(113, 220, 255, .52),
        0 0 11px rgba(20, 168, 255, .45),
        0 0 20px rgba(255, 58, 32, .30) !important;
}

body.pg-collection .chat-avatar-selected-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    align-self: center;
    margin: 3px 0 5px;
    padding: 3px 7px;
    border: 1px solid rgba(113, 220, 255, .45);
    border-radius: 999px;
    background: rgba(20, 168, 255, .10);
    color: #71dcff;
    font-size: 8px;
    font-weight: 900;
    letter-spacing: .04em;
    text-transform: uppercase;
}

@media (max-width: 1024px) {
    body.pg-collection .chat-avatar-slot {
        min-height: 305px;
        padding: 11px;
    }

    body.pg-collection .chat-avatar-sprite {
        width: 100px !important;
        height: 100px !important;
    }
}


/* ==========================================================================
   FILTRE PAR TIER + TIER SUR LES CARTES DE L'ÉQUIPE
   ========================================================================== */

body.pg-collection .pokemon-id.pokemon-id-tier {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    max-width: calc(100% - 50px);
    white-space: nowrap;
}

body.pg-collection .pokemon-tier {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 16px;
    padding: 2px 5px;
    border-radius: 999px;
    font-size: 7px;
    line-height: 1;
    font-weight: 900;
    letter-spacing: .15px;
    color: #fff;
    border: 1px solid rgba(255,255,255,.14);
}

body.pg-collection .pokemon-tier.tier-commun {
    background: #59616d;
}

body.pg-collection .pokemon-tier.tier-peu-rare {
    background: #3d78b8;
}

body.pg-collection .pokemon-tier.tier-rare {
    background: #7a57bd;
}

body.pg-collection .pokemon-tier.tier-tres-rare {
    background: #bd7b2f;
}

body.pg-collection .pokemon-tier.tier-legendaire {
    background: #a33e45;
}

body.pg-collection .pokemon-tier.tier-baby {
    background: #4f956a;
}

body.pg-collection .pokemon-tier.tier-inconnu {
    background: #333b46;
    color: #aeb7c4;
}

body.pg-collection .team-filter-bar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0;
    padding: 10px 20px;
    border-bottom: 1px solid #333;
    background: rgba(255,255,255,.02);
}

body.pg-collection #teamSearch,
body.pg-collection #teamTierFilter {
    min-height: 38px;
    border: 1px solid var(--pg-border);
    border-radius: 8px;
    background: #0b1018;
    color: var(--pg-text);
    outline: none;
    font-family: inherit;
    font-size: 10px;
}

body.pg-collection #teamSearch {
    width: min(100%, 280px);
    padding: 8px 11px;
}

body.pg-collection #teamTierFilter {
    min-width: 150px;
    padding: 8px 30px 8px 10px;
    cursor: pointer;
}

body.pg-collection #teamSearch:focus,
body.pg-collection #teamTierFilter:focus {
    border-color: var(--pg-gold);
}

body.pg-collection .team-tier-filter-label {
    margin-left: 4px;
    color: var(--pg-muted);
    font-size: 9px;
    font-weight: 900;
    letter-spacing: .4px;
    text-transform: uppercase;
}

body.pg-collection .team-filter-count {
    margin-left: auto;
    color: var(--pg-muted);
    font-size: 9px;
    font-weight: 800;
}

@media (max-width: 620px) {
    body.pg-collection .team-filter-bar {
        gap: 6px;
        padding: 7px;
    }

    body.pg-collection #teamSearch {
        flex: 1 1 100%;
        width: 100%;
        min-height: 34px;
    }

    body.pg-collection .team-tier-filter-label {
        margin-left: 0;
    }

    body.pg-collection #teamTierFilter {
        flex: 1 1 auto;
        min-width: 0;
        min-height: 34px;
        font-size: 8px;
    }

    body.pg-collection .team-filter-count {
        flex: 0 0 auto;
        font-size: 7px;
    }

    body.pg-collection .pokemon-id.pokemon-id-tier {
        gap: 3px;
        max-width: calc(100% - 34px);
    }

    body.pg-collection .pokemon-tier {
        min-height: 14px;
        padding: 2px 4px;
        font-size: 5.8px;
    }
}

/* Reproduction : état explicite pour éviter les dépenses d'XP inutiles. */
.breed-badge.cannot-breed {
    color: #e57373;
    border-color: #8d3f3f;
    opacity: .75;
    filter: grayscale(.35);
}

.breeding-status {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    min-height: 28px;
    margin: 2px 0 7px;
    padding: 5px 7px;
    border: 1px solid #3a4350;
    border-radius: 7px;
    background: rgba(0,0,0,.28);
    font-size: 9px;
    font-weight: 800;
    line-height: 1.25;
}

.breeding-status.can-breed { border-color: #5b8c5a; color: #b8e7b6; }
.breeding-status.too-low { border-color: #5b6470; color: #bac2cc; }
.breeding-status.used-breed,
.breeding-status.cannot-breed { border-color: #704141; color: #e0a3a3; }

.xp-breed-notice {
    margin: 4px 0 14px;
    padding: 9px 10px;
    border: 1px solid #465260;
    border-radius: 8px;
    background: rgba(255,255,255,.035);
    font-size: 11px;
    line-height: 1.4;
    text-align: left;
}
.xp-breed-notice.is-warning { border-color: #8d3f3f; color: #f0b4b4; background: rgba(141,63,63,.12); }
.xp-breed-notice.is-info { border-color: #53667c; color: #c4d0dd; background: rgba(83,102,124,.12); }
.xp-breed-notice.is-ok { border-color: #4f7c52; color: #bee1c0; background: rgba(79,124,82,.12); }


/* ========================================================================== 
   INFO ÉVOLUTION — badge compact à côté de la reproduction
   ========================================================================== */
body.pg-collection .evolution-info-badge {
    position: absolute;
    top: 8px;
    left: 42px;
    z-index: 42;
    display: grid;
    width: 26px;
    height: 26px;
    padding: 0;
    place-items: center;
    border: 1px solid #52657d;
    border-radius: 50%;
    background: #090e16;
    color: #9ecbff;
    font: inherit;
    font-size: 13px;
    line-height: 1;
    cursor: help;
    box-shadow: none;
}

body.pg-collection .pokemon-card.locked-box .evolution-info-badge {
    opacity: 1 !important;
    pointer-events: auto !important;
}

body.pg-collection .evolution-info-badge:hover,
body.pg-collection .evolution-info-badge:focus-visible,
body.pg-collection .evolution-info-badge.is-open {
    border-color: var(--pg-blue);
    color: #d7ecff;
    outline: none;
}

body.pg-collection .evolution-tooltip-global {
    position: fixed;
    z-index: 100000;
    display: none;
    width: min(280px, calc(100vw - 20px));
    padding: 10px 11px;
    border: 1px solid #52657d;
    border-radius: 10px;
    background: #080d14;
    color: #dce6f2;
    box-shadow: 0 10px 28px rgba(0, 0, 0, .45);
    font-size: 10px;
    font-weight: 600;
    line-height: 1.4;
    text-align: left;
    white-space: normal;
    pointer-events: none;
}

body.pg-collection .evolution-tooltip-global.is-visible {
    display: block;
}

body.pg-collection .evolution-tooltip-global strong {
    display: block;
    margin-bottom: 6px;
    color: var(--pg-blue);
    font-size: 10px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: .25px;
}

body.pg-collection .evolution-tooltip-global > span {
    display: block;
    padding: 4px 0;
    border-top: 1px solid rgba(255,255,255,.06);
}

body.pg-collection .evolution-tooltip-global > span:first-of-type {
    border-top: 0;
}

@media (max-width: 620px) {
    body.pg-collection .evolution-info-badge {
        top: 5px;
        left: 32px;
        width: 22px;
        height: 22px;
        font-size: 10px;
    }

    body.pg-collection .evolution-tooltip-global {
        width: min(240px, calc(100vw - 16px));
        padding: 8px 9px;
        font-size: 8px;
    }

    body.pg-collection .evolution-tooltip-global strong {
        font-size: 8px;
    }
}

/* GEN4 — Badge de génération et date d'évolution */
body.pg-collection .pokemon-traits .generation-badge {
    background: #22344b;
    border-color: #466789;
    color: #b9d9ff;
    text-shadow: none;
    letter-spacing: .4px;
    flex-shrink: 0;
}

body.pg-collection .history-info .evolution-date-line {
    color: var(--pg-gold, #f4c84a);
    font-weight: 800;
}


/* ========================================================================== 
   HISTORIQUE DE REPRODUCTION — Aubergine barrée
   Le filtre concerne les Pokémon avec breed_uses > 0, même si une utilisation
   reste disponible (exemple : Métamorph 1/2).
   ========================================================================== */

body.pg-collection .btn-sort-bred {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    border-color: rgba(194, 139, 255, .55) !important;
    color: #dfc5ff !important;
}

body.pg-collection .btn-sort-bred:hover,
body.pg-collection .btn-sort-bred.active {
    border-color: #d3a5ff !important;
    background: #9d6ac8 !important;
    color: #fff !important;
}

/* Une barre rouge diagonale traverse l'emoji, quel que soit le système. */
.breed-used-icon {
    position: relative;
    display: inline-grid;
    width: 1.55em;
    height: 1.55em;
    flex: 0 0 auto;
    place-items: center;
    font-size: 15px;
    line-height: 1;
    vertical-align: middle;
}

.breed-used-icon::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 2%;
    width: 96%;
    height: 3px;
    border-radius: 3px;
    background: #ff6b67;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, .72);
    transform: translateY(-50%) rotate(-45deg);
    pointer-events: none;
}

/* Badge supplémentaire : le badge de reproduction d'origine est conservé. */
body.pg-collection .breed-history-badge {
    position: absolute;
    z-index: 19;
    top: 43px;
    left: 8px;
    display: grid;
    width: 26px;
    height: 26px;
    place-items: center;
    border: 1px solid #9866bf;
    border-radius: 50%;
    background: #160f21;
    color: #fff;
    cursor: help;
}

/* Les cartes favoris n'ont pas le badge de reproduction du coin supérieur. */
body.pg-collection .favorite-breed-history-badge {
    top: 8px;
}

@media (max-width: 620px) {
    body.pg-collection .breed-history-badge {
        top: 33px;
        left: 5px;
        width: 22px;
        height: 22px;
    }

    body.pg-collection .favorite-breed-history-badge {
        top: 5px;
    }

    .breed-used-icon {
        font-size: 12px;
    }
}


/* ==========================================================================
   TRANSFERT DE POKÉMON — DIALOGUE À TOTAL XP TOUJOURS VISIBLE
   ========================================================================== */

body.pg-collection.transfer-confirm-open {
    overflow: hidden;
}

body.pg-collection .transfer-confirm-modal {
    position: fixed;
    inset: 0;
    z-index: 11000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 14px;
    background: rgba(3, 7, 12, .86);
}

body.pg-collection .transfer-confirm-modal[hidden],
body.pg-collection .transfer-xp-receipt[hidden] {
    display: none !important;
}

body.pg-collection .transfer-confirm-dialog {
    display: flex;
    flex-direction: column;
    width: min(100%, 600px);
    max-height: min(88dvh, 780px);
    min-height: 0;
    overflow: hidden;
    border: 1px solid #6b592c;
    border-radius: 16px;
    background: #111925;
    color: #f6f8fb;
    box-shadow: 0 22px 70px rgba(0, 0, 0, .6);
}

body.pg-collection .transfer-confirm-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    flex: 0 0 auto;
    padding: 20px 22px 14px;
    border-bottom: 1px solid #303a49;
}

body.pg-collection .transfer-confirm-eyebrow {
    color: var(--pg-gold, #f4c84a);
    font-size: 10px;
    font-weight: 900;
    letter-spacing: 1px;
}

body.pg-collection .transfer-confirm-header h2 {
    margin: 6px 0 4px;
    font-size: clamp(18px, 3vw, 23px);
    line-height: 1.2;
}

body.pg-collection .transfer-confirm-header p {
    margin: 0;
    color: #a9b6c8;
    font-size: 11px;
    line-height: 1.5;
}

body.pg-collection .transfer-confirm-close {
    flex: 0 0 auto;
    width: 32px;
    height: 32px;
    border: 1px solid #465368;
    border-radius: 8px;
    background: #1d2838;
    color: #f6f8fb;
    cursor: pointer;
}

body.pg-collection .transfer-confirm-content {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    min-height: 0;
    padding: 14px 22px;
    overflow: hidden;
}

body.pg-collection .transfer-confirm-count {
    flex: 0 0 auto;
    margin-bottom: 8px;
    color: #d4e4f4;
    font-size: 12px;
    font-weight: 800;
}

body.pg-collection .transfer-confirm-list {
    display: block;
    flex: 1 1 auto;
    min-height: 0;
    margin: 0;
    padding: 0 5px 0 0;
    overflow-y: auto;
    overflow-x: hidden;
    list-style: none;
    scrollbar-width: thin;
    scrollbar-color: #4c6d88 #0c1420;
}

body.pg-collection .transfer-confirm-list li {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
    padding: 9px 10px;
    border-bottom: 1px solid #273444;
    font-size: 12px;
}

body.pg-collection .transfer-confirm-list li:nth-child(odd) {
    background: rgba(255, 255, 255, .025);
}

body.pg-collection .transfer-confirm-list li span {
    min-width: 0;
    overflow-wrap: anywhere;
}

body.pg-collection .transfer-confirm-list li strong {
    flex: 0 0 auto;
    color: #b7e9c7;
    font-size: 12px;
    white-space: nowrap;
}

body.pg-collection .transfer-confirm-footer {
    flex: 0 0 auto;
    padding: 16px 22px 20px;
    border-top: 1px solid #66542b;
    background: #0b131e;
}

body.pg-collection .transfer-confirm-total {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

body.pg-collection .transfer-confirm-total span {
    color: #acbcd0;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .6px;
}

body.pg-collection .transfer-confirm-total strong {
    color: #f4c84a;
    font-size: clamp(20px, 4vw, 27px);
    font-weight: 950;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

body.pg-collection .transfer-confirm-feedback {
    min-height: 0;
    margin: 0 0 7px;
    color: #b3c5d5;
    font-size: 11px;
    line-height: 1.45;
}

body.pg-collection .transfer-confirm-feedback:empty {
    display: none;
}

body.pg-collection .transfer-confirm-feedback.is-error {
    color: #ff9898;
}

body.pg-collection .transfer-confirm-buttons {
    display: grid;
    grid-template-columns: 1fr 1.4fr;
    gap: 9px;
}

body.pg-collection .transfer-confirm-buttons button {
    min-height: 43px;
    padding: 9px 12px;
    border-radius: 9px;
    font-family: inherit;
    font-size: 12px;
    font-weight: 900;
    cursor: pointer;
}

body.pg-collection .transfer-confirm-cancel {
    border: 1px solid #4c5c6b;
    background: #1d2a39;
    color: #f0f5fa;
}

body.pg-collection .transfer-confirm-submit {
    border: 1px solid #f4c84a;
    background: #eebf37;
    color: #101720;
}

body.pg-collection .transfer-confirm-submit:disabled {
    opacity: .58;
    cursor: wait;
}

body.pg-collection .transfer-xp-receipt {
    position: fixed;
    right: 18px;
    bottom: 18px;
    z-index: 10900;
    display: flex;
    align-items: flex-start;
    gap: 14px;
    width: min(calc(100vw - 36px), 540px);
    padding: 15px 17px;
    border: 1px solid #4d9a78;
    border-radius: 12px;
    background: #11271f;
    box-shadow: 0 12px 45px rgba(0, 0, 0, .48);
}

body.pg-collection .transfer-xp-receipt.is-warning {
    border-color: #e0a747;
    background: #2b2518;
}

body.pg-collection #transferXpReceiptText {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    gap: 5px;
    color: #e6f5eb;
    font-size: 11px;
    line-height: 1.5;
}

body.pg-collection #transferXpReceiptText strong {
    color: #fff;
    font-size: 13px;
}

body.pg-collection #transferXpReceiptClose {
    flex: 0 0 auto;
    width: 25px;
    height: 25px;
    border: 0;
    border-radius: 6px;
    background: rgba(255, 255, 255, .12);
    color: #fff;
    cursor: pointer;
}

@media (max-width: 620px) {
    body.pg-collection .transfer-confirm-modal {
        padding: 8px;
    }

    body.pg-collection .transfer-confirm-dialog {
        max-height: calc(100dvh - 16px);
        border-radius: 12px;
    }

    body.pg-collection .transfer-confirm-header {
        padding: 13px 14px 10px;
    }

    body.pg-collection .transfer-confirm-content {
        padding: 10px 14px;
    }

    body.pg-collection .transfer-confirm-footer {
        padding: 12px 14px;
    }

    body.pg-collection .transfer-confirm-list li {
        font-size: 11px;
    }
}


/* ============================================================================
   POKÉMON ISSUS DES MÉGA RAIDS — origine conservée lors des évolutions
   Aura statique et discrète ; traitements Shiny / Favoris combinables.
   ============================================================================ */
body.pg-collection #section-actifs .pokemon-card.raid-origin,
body.pg-collection #section-favoris .pokemon-card.raid-origin {
    border-color: #d3ae56 !important;
    background: linear-gradient(160deg, rgba(209, 164, 58, .17), rgba(191, 145, 52, .035) 42%, transparent 75%), #141820 !important;
    box-shadow: inset 0 0 0 1px rgba(246, 206, 115, .18),
                0 0 13px rgba(216, 165, 55, .24) !important;
}
body.pg-collection #section-actifs .pokemon-card.raid-origin:hover,
body.pg-collection #section-favoris .pokemon-card.raid-origin:hover {
    border-color: #f2ce76 !important;
    background: linear-gradient(160deg, rgba(215, 170, 70, .21), rgba(203, 153, 50, .05) 42%, transparent 75%), #171d26 !important;
    box-shadow: inset 0 0 0 1px rgba(246, 206, 115, .24),
                0 0 16px rgba(216, 165, 55, .29) !important;
}

/* Shiny Raid : conserver l'identité orangée du Shiny et l'origine dorée. */
body.pg-collection #section-actifs .pokemon-card.raid-origin.shiny-card,
body.pg-collection #section-favoris .pokemon-card.raid-origin.shiny-card {
    border-color: #f4b86a !important;
    background: linear-gradient(160deg, rgba(243, 169, 64, .14), rgba(255, 79, 42, .10) 42%, transparent 72%), #1b1517 !important;
    box-shadow: inset 0 0 0 2px rgba(240, 190, 67, .43),
                0 0 13px rgba(255, 77, 39, .46),
                0 0 22px rgba(228, 169, 57, .23) !important;
}
@keyframes pg-raid-shiny-aura-pulse {
    0%, 100% {
        box-shadow: inset 0 0 0 2px rgba(240, 190, 67, .43),
                    0 0 12px rgba(255, 77, 39, .40),
                    0 0 20px rgba(228, 169, 57, .22);
    }
    50% {
        box-shadow: inset 0 0 0 2px rgba(247, 206, 107, .60),
                    0 0 17px rgba(255, 87, 48, .62),
                    0 0 25px rgba(228, 169, 57, .31);
    }
}
@media (min-width: 1025px) and (prefers-reduced-motion: no-preference) {
    body.pg-collection #section-actifs .pokemon-card.raid-origin.shiny-card:not(.favorite-glow),
    body.pg-collection #section-favoris .pokemon-card.raid-origin.shiny-card:not(.favorite-glow) {
        animation: pg-raid-shiny-aura-pulse 2.8s ease-in-out infinite !important;
    }
}

/* Archives : badge préservé, aura atténuée pour ne pas masquer l'état archivé. */
body.pg-collection #section-archives .pokemon-card.archived.raid-origin {
    border-color: #937443 !important;
    background: linear-gradient(160deg, rgba(181, 140, 63, .11), transparent 65%), #0c1119 !important;
    box-shadow: inset 0 0 0 1px rgba(220, 174, 77, .12) !important;
}

body.pg-collection .raid-origin-badge {
    position: absolute;
    z-index: 21;
    top: 8px;
    left: 41px; /* Laisse la place au badge de reproduction à gauche. */
    display: grid;
    place-items: center;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: 1px solid #f0cf84;
    background: #3b2b0f;
    color: #ffe6a1;
    box-shadow: inset 0 0 0 1px rgba(255, 224, 151, .15);
    font-size: 12px;
    font-weight: 900;
    line-height: 1;
    cursor: help;
    user-select: none;
}
body.pg-collection .raid-origin-badge.archive-raid-origin-badge {
    left: 8px;
}
body.pg-collection #section-actifs .btn-sort-raid.active {
    border-color: #dcb45a !important;
    background: #dcb45a !important;
    color: #16110a !important;
}
@media (max-width: 1024px) {
    body.pg-collection #section-actifs .pokemon-card.raid-origin.shiny-card,
    body.pg-collection #section-favoris .pokemon-card.raid-origin.shiny-card {
        animation: none !important;
    }
}
@media (max-width: 620px) {
    body.pg-collection .raid-origin-badge {
        top: 6px;
        left: 33px;
        width: 22px;
        height: 22px;
        font-size: 11px;
    }
    body.pg-collection .raid-origin-badge.archive-raid-origin-badge {
        left: 6px;
    }
    body.pg-collection #section-actifs .pokemon-card.raid-origin,
    body.pg-collection #section-favoris .pokemon-card.raid-origin {
        box-shadow: inset 0 0 0 1px rgba(246, 206, 115, .16),
                    0 0 8px rgba(216, 165, 55, .21) !important;
    }
}

/* =========================================================
   Correctif affichage origine RAID : eviter la superposition
   du badge R et du bouton d'information d'evolution.
   - Ligne 1 : reproduction / RAID
   - Ligne 2 : historique reproduction / evolution
   Ce decalage ne concerne QUE les cartes de RAID actives.
========================================================= */
body.pg-collection #section-actifs .pokemon-card.raid-origin > .evolution-info-badge {
    top: 43px;
    left: 42px;
}

@media (max-width: 620px) {
    body.pg-collection #section-actifs .pokemon-card.raid-origin > .evolution-info-badge {
        top: 33px;
        left: 32px;
    }
}


/* ==========================================================================
   COMPTEURS MÉGA RAID — HEADER (sans toucher aux badges des cartes)
   ========================================================================== */
body.pg-collection .stats-container .stat-item.stat-item-raid {
    border-color: rgba(206, 166, 79, .62) !important;
    background: linear-gradient(155deg, rgba(122, 90, 36, .24), #181e29 72%) !important;
}
body.pg-collection .stats-container .stat-item.stat-item-raid .stat-label {
    color: #f1d18a !important;
    line-height: 1.2 !important;
}
body.pg-collection .stats-container .stat-item.stat-item-raid .stat-value {
    color: #ffe3a1 !important;
}
body.pg-collection .stats-container .stat-item.stat-item-raid:hover {
    border-color: #e1b95d !important;
    background: linear-gradient(155deg, rgba(122, 90, 36, .34), #202735 72%) !important;
}


/* =========================================================
   QoL équipe : filtres Sexe et Exemplaires (combinables).
   Même style et comportement responsive que les filtres existants.
========================================================= */
body.pg-collection #teamGenderFilter,
body.pg-collection #teamMultiplesFilter {
    min-height: 38px;
    min-width: 132px;
    padding: 8px 12px;
    border: 1px solid var(--pg-border, #333);
    border-radius: 8px;
    background: #0b1018;
    color: var(--pg-text, #fff);
    font-family: inherit;
    font-size: 10px;
    cursor: pointer;
}
body.pg-collection #teamGenderFilter:focus-visible,
body.pg-collection #teamMultiplesFilter:focus-visible {
    outline: 2px solid var(--pg-gold, #f4ca48);
    outline-offset: 1px;
}
@media (max-width: 620px) {
    body.pg-collection #teamGenderFilter,
    body.pg-collection #teamMultiplesFilter {
        flex: 1 1 125px;
        min-width: 0;
        min-height: 34px;
        font-size: 9px;
    }
}
