@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&family=Nunito:wght@400;600;800&display=swap');
/* Importe deux polices Google : Press Start 2P (style rétro Pokémon) et Nunito (texte lisible) */


/* ── Reset ── */
/* Supprime les marges et paddings par défaut du navigateur sur tous les éléments */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background: #1a1a2e;
    color: white;
    font-family: 'Nunito', sans-serif;
    min-height: 100vh;
    overflow: hidden;
    background-image: radial-gradient(circle at 20% 50%, #16213e 0%, #1a1a2e 50%, #0f3460 100%);
}

#wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    width: 100%;
}

/* Press Start 2P pour les grands titres, donne le style arcade rétro */
h1,
h2 {
    font-family: 'Press Start 2P', cursive;
    margin-bottom: 15px;
    font-size: 14px;
    color: #F5D44A;
    text-shadow: 2px 2px 0px #C9A800;
    text-align: center;
}

/* ── Écrans ── */
#selection,
#selection_adversaire,
#jeu,
#game_over,
#victoire,
#attrape {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
    padding: 10%;
    width: 100%;
    max-width: 700px;
    overflow-y: auto;
    max-height: 100vh;
    padding: 5%;
}

/* ── Titres ── */
#selection_adversaire h2 {
    font-size: 14px;
    color: #F5D44A;
    text-shadow: 2px 2px 0px #C9A800;
    text-align: center;
}

/* Zone de combat : joueur à gauche, adversaire à droite */
#zone_combat {
    position: relative;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    width: 100%;
    max-width: 400px;
    height: 200px;
}

/* joeur plus grand que l'adversaire pour effet d'eloignement*/
#img_joueur {
    position: absolute;
    width: 35%;
    /* adapte la taille du sprite selon le conteneur */
    left: 22%;
    /* position horizontale dans le cercle gauche */
    bottom: 15%;
    /* position verticale depuis le bas */
    z-index: 10;
}

#img_adversaire {
    position: absolute;
    width: 18%;
    /* plus petit pour l’adversaire */
    right: 10%;
    /* position horizontale dans le cercle droit */
    bottom: 57%;
    /* même niveau vertical que le joueur */
    z-index: 10;
}

.barre_pv_conteneur {
    width: 100%;
    max-width: 400px;
    height: 12px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 10px;
}

.barre_pv {
    height: 100%;
    width: 100%;
    background: #4ecb8d;
    border-radius: 6px;
    transition: width 0.3s ease;
}

#barre_pv_adversaire {
    background: #e24b4a;

}

#selection_caractere,
#selection_adversaire_grid {
    display: grid;
    grid-template-columns: repeat(4, 150px);
    /* 3 colonnes fixes */
    grid-auto-flow: column;
    gap: 16px;
    overflow-x: auto;
    /* scroll horizontal */
    overflow-y: hidden;
    max-width: 420px;
    padding-top: 8px;
    padding-bottom: 8px;
    scroll-snap-type: x mandatory;
    /* snap au scroll */
    grid-template-columns: unset;
    width: 100%;
}

#selection_caractere .carte_caractere,
#selection_adversaire_grid .carte_caractere {
    scroll-snap-align: start;
}

/* Scrollbar stylisée */
#selection_caractere::-webkit-scrollbar,
#selection_adversaire_grid::-webkit-scrollbar {
    height: 11px;
}

#selection_caractere::-webkit-scrollbar-track,
#selection_adversaire_grid::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 3px;
}

#selection_caractere::-webkit-scrollbar-thumb,
#selection_adversaire_grid::-webkit-scrollbar-thumb {
    background: #F5D44A;
    border-radius: 3px;
}

/* ── Cartes personnage ── */
.carte_caractere {
    background: rgba(255, 255, 255, 0.07);
    border: 2px solid rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    padding: 16px;
    width: 120px;
    text-align: center;
    cursor: pointer;
    transition: transform 0.15s, border-color 0.15s, background 0.15s;
}

.carte_caractere:hover {
    transform: translateY(-4px);
    border-color: #3EC9C9;
    background: rgba(62, 201, 201, 0.1);
}

.carte_caractere img {
    width: 80px;
    height: 80px;
    object-fit: contain;
}

.carte_caractere p {
    margin-top: 6px;
    font-size: 12px;
    font-weight: 600;
    text-transform: capitalize;
}

.carte_caractere p:last-child {
    font-size: 10px;
    color: #8888aa;
    margin-top: 2px;
}

/* ── Carte sélectionnée ── */
.choix {
    border-color: #F5D44A !important;
    background: rgba(245, 212, 74, 0.15) !important;
    transform: translateY(-4px);
}

/* Carte verrouillée : grisée, curseur interdit */
.verouille {
    opacity: 0.35;
    cursor: not-allowed;
    filter: grayscale(80%);
}

.verouille:hover {
    transform: none !important;
    border-color: rgba(255, 255, 255, 0.15) !important;
    background: rgba(255, 255, 255, 0.07) !important;
}

/* ── Boutons principaux ── */
button {
    background: #F5D44A;
    color: #1a1a2e;
    border: none;
    border-radius: 8px;
    padding: 12px 32px;
    font-family: 'Press Start 2P', cursive;
    font-size: 11px;
    cursor: pointer;
    transition: transform 0.1s, background 0.15s;
    box-shadow: 0 4px 0 #C9A800;
}

button:hover {
    background: #ffe066;
    transform: translateY(-2px);
}

button:active {
    transform: translateY(2px);
    box-shadow: none;
}

/* ── Zone de combat ── */
#jeu {
    gap: 16px;
}

#pv_joueur,
#pv_adversaire {
    font-family: 'Press Start 2P', cursive;
    font-size: 10px;
    background: rgba(0, 0, 0, 0.4);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 10px 20px;
    width: 100%;
    max-width: 400px;
    text-align: center;

}

#pv_joueur {
    color: #4ecb8d;
}

#pv_adversaire {
    color: #e24b4a;
}

/* ── Menu actions ── */
#menu_actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    width: 100%;
    max-width: 400px;
    margin-top: 10px;
}

#menu_actions button {
    font-size: 15px;
    padding: 14px 8px;
}

/* ── Menu calcul ── */
#menu_calcul {
    display: flex;
    flex-direction: row;
    /* ← horizontal au lieu de vertical */
    align-items: center;
    flex-wrap: wrap;
    /* ← pour que le calcul reste au dessus */
    gap: 12px;
    background: rgba(0, 0, 0, 0.4);
    border: 2px solid rgba(62, 201, 201, 0.4);
    border-radius: 12px;
    padding: 24px;
    width: 100%;
    max-width: 400px;
    margin-top: 10px;
    justify-content: center;
}

#calcul {
    font-family: 'Press Start 2P', cursive;
    font-size: 18px;
    color: #F5D44A;
    text-shadow: 2px 2px 0px #C9A800;
    width: 100%;
    /* ← force le calcul sur sa propre ligne */
    text-align: center;
}

#reponse {
    width: 100px;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    color: white;
    font-family: 'Press Start 2P', cursive;
    font-size: 18px;
    text-align: center;
    padding: 8px;
    outline: none;
    transition: border-color 0.15s;
}

#reponse:focus {
    border-color: #3EC9C9;
}

/* ── Écrans de fin ── */
#game_over h1 {
    color: #e24b4a;
    font-size: 24px;
    text-shadow: 3px 3px 0px #7a1f1f;
}

#victoire h1 {
    color: #4ecb8d;
    font-size: 24px;
    text-shadow: 3px 3px 0px #1f6e4b;
}

#attrape h1 {
    color: #F5D44A;
    font-size: 24px;
    text-shadow: 3px 3px 0px #C9A800;
}

#fond_combat {
    width: 1000px;
    height: 200px;
    align-self: flex-start;
    z-index: 1;

}




#commencer_combat {
    align-self: center;
    margin: 0 auto;
    display: block;

}


#message,
#objet_drop {
    font-family: 'Press Start 2P', cursive;
    font-size: 10px;
    background: rgba(0, 0, 0, 0.4);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 10px 20px;
    width: 100%;
    max-width: 400px;
    text-align: center;
    margin-bottom: 10px;

}

/* ── Menu objets ── */
#menu_objets {
    position: fixed;
    top: 20%;
    /* ← ancre le haut, peu importe la hauteur du contenu */
    right: 5%;
    flex-direction: column;
    gap: 8px;
    background: rgba(0, 0, 0, 0.6);
    border: 2px solid rgba(62, 201, 201, 0.4);
    border-radius: 12px;
    padding: 16px;
    width: 350px;
    z-index: 9998;
    max-height: 80vh;
    overflow-y: auto;
}


#menu_objets_header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

#menu_objets_header p {
    font-family: 'Press Start 2P', cursive;
    font-size: 11px;
    color: #F5D44A;
}

#btn_fermer_objets {
    padding: 4px 10px;
    font-size: 12px;
    background: #e24b4a;
    box-shadow: 0 3px 0 #7a1f1f;
}

#btn_fermer_calcul {
    padding: 4px 10px;
    font-size: 12px;
    background: #e24b4a;
    box-shadow: 0 3px 0 #7a1f1f;
    margin-left: 100%;
    margin-top: -5%;
}

#liste_objets {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.titre_categorie {
    font-family: 'Press Start 2P', cursive;
    font-size: 8px;
    color: #8888aa;
    text-transform: uppercase;
    margin-top: 6px;
}

.btn_objet {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    font-size: 10px;
    width: 100%;

}

.btn_objet span {
    font-size: 9px;
}

#god_mode {
    position: fixed !important;
    top: 20px !important;
    left: 20px !important;
    background: #e24b4a;
    box-shadow: 0 4px 0 #7a1f1f;
    z-index: 99999;
    margin: 0 !important;
    /* ← annule tout margin hérité */
    transform: none !important;
    /* ← annule tout transform hérité */
}

#god_mode:hover {
    background: #f65f5f;
    transform: translateY(-4px);
}

#img_joueur {
    position: absolute;
    width: 120px;
    height: 120px;
    object-fit: contain;
    left: 30%;
    bottom: 19%;
    z-index: 10;
}

#img_adversaire {
    position: absolute;
    width: 55px;
    height: 90px;
    object-fit: contain;
    right: 13%;
    top: 5%;
    z-index: 10;
}

img {
    z-index: 10000;
    user-select: none;
    -webkit-user-drag: none;
}

#volumes {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 99999;
    cursor: pointer;
    width: 50px;
}

#overlay_roulette {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.8);
    z-index: 99990;
    display: flex;
    align-items: center;
    justify-content: center;
}

#fenetre_roulette {
    background: #1a1a2e;
    border: 2px solid rgba(62, 201, 201, 0.4);
    border-radius: 16px;
    padding: 32px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
    max-width: 600px;
    width: 90%;
}

#conteneur_roulette {
    width: 100%;
    max-width: 420px;
    overflow: hidden;
    border: 3px solid #F5D44A;
    border-radius: 12px;
    position: relative;
}

/* Indicateur central */
#conteneur_roulette::after {
    background: #1a1a2e;
    border: 2px solid rgba(62, 201, 201, 0.4);
    border-radius: 16px;
    padding: 16px;
    /* ← réduire le padding sur mobile */
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
    max-width: 600px;
    width: 95%;
    /* ← au lieu de 90% */
    box-sizing: border-box;
}

#piste_roulette {
    display: flex;
    gap: 16px;
    padding: 16px;
    transition: transform 0.1s linear;
    will-change: transform;
}

.carte_roulette {
    min-width: 120px;
    background: rgba(255, 255, 255, 0.07);
    border: 2px solid rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    padding: 12px;
    text-align: center;
    flex-shrink: 0;
}

.carte_roulette img {
    width: 60px;
    height: 60px;
    object-fit: contain;
}

.carte_roulette p {
    font-size: 10px;
    margin-top: 6px;
    font-weight: 600;
}

#resultat_roulette {
    flex-direction: column;
    align-items: center;
    gap: 12px;
    font-family: 'Press Start 2P', cursive;
    font-size: 11px;
    color: #F5D44A;
    text-align: center;
}

#btn_fermer_roulette {
    margin-top: 8px;
}

#grille_boutons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    width: 100%;
    max-width: 420px;
}

#grille_boutons button {
    font-size: 10px;
    padding: 14px 8px;
}

html,
body {
    height: 100%;
    overflow: hidden;
    width: 100%;
}

body {
    position: fixed;
    /* ← bloque le scroll natif iOS/Android */
}

#wrapper {
    height: 100vh;
    overflow: hidden;
}


/* ── Authentification & Starter ── */
/* ── Bulle CSS ── */
.bulle_texte {
    position: relative;
    background: white;
    border: 3px solid #1a1a2e;
    border-radius: 16px;
    padding: 16px 20px;
    max-width: 280px;
    margin-bottom: 16px;
}

.bulle_texte::after {
    content: "";
    position: absolute;
    bottom: -18px;
    left: 30px;
    border: 9px solid transparent;
    border-top-color: #1a1a2e;
}

.bulle_texte::before {
    content: "";
    position: absolute;
    bottom: -12px;
    left: 32px;
    border: 7px solid transparent;
    border-top-color: white;
    z-index: 1;
}

.bulle_texte p {
    color: #1a1a2e;
    font-family: 'Press Start 2P', cursive;
    font-size: 9px;
    line-height: 1.8;
    text-align: center;
    margin: 0;
}

/* ── Authentification & Starter (Correction Centrage) ── */
#authentification,
#starter {
    display: none;
    /* Changé en 'flex' par le JS j'imagine */
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    /* Prend toute la largeur */
    min-height: 100vh;
    /* Prend toute la hauteur */
    gap: 30px;
    padding: 20px;
    position: absolute;
    /* S'assure qu'il se superpose bien au fond */
    top: 0;
    left: 0;
    z-index: 100;
}

#zone_chen,
#zone_chen_starter {
    display: flex;
    flex-direction: column;
    /* On passe en colonne pour un centrage plus facile */
    align-items: center;
    /* Centre Chen et la bulle sur le même axe */
    justify-content: center;
    gap: 10px;
    width: 100%;
}

/* Si tu veux garder Chen et la bulle côte à côte sur PC uniquement */
@media (min-width: 768px) {

    #zone_chen,
    #zone_chen_starter {
        flex-direction: row;
        align-items: flex-end;
    }
}

#img_chen,
#zone_chen_starter img:first-child {
    width: 160px;
    height: auto;
    image-rendering: pixelated;
    display: block;
}



/* On centre la flèche de la bulle quand on est en mode colonne (mobile) */
.bulle_texte::after,
.bulle_texte::before {
    left: 50%;
    transform: translateX(-50%);
}

/* ── Input & Bouton Continuer ── */
#input_prenom,
#input_recherche,
#input_recherche_adversaire {
    display: block;
    margin: 0 auto;
    /* Centre horizontalement */
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    color: white;
    font-family: 'Press Start 2P', cursive;
    font-size: 12px;
    text-align: center;
    padding: 15px;
    outline: none;
    width: 100%;
    max-width: 300px;
    /* Largeur max pour ne pas être trop grand */
    transition: all 0.2s;
}

/* Conteneur pour le bouton après l'input pour être sûr qu'il suit le centrage */
#authentification button {
    margin-top: 10px;
}

/* ── Grille starters (Correction Gen 1, 2, etc) ── */
#grille_starters {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    justify-content: center;
    /* Centre les boutons de générations */
    align-items: center;
    width: 100%;
    max-width: 500px;
    /* Limite la largeur pour forcer le retour à la ligne propre */
    margin: 20px auto 0 auto;

}

#grille_starters button {
    min-width: 120px;
    /* Donne une taille uniforme aux boutons Gen */
}

.bulle_texte {
    align-self: flex-start;
    margin-top: 0;
}

/* ── Authentification (Bouton sous l'input) ── */
#authentification {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 15px;
    /* Réduit l'espace pour que le bouton soit "juste" en dessous */
}

#authentification button {
    margin-top: 0;
    /* On laisse le gap gérer l'espace */
    width: fit-content;
    /* S'assure que le bouton ne prend pas toute la largeur */
}

/* ── Section Starter / Prof Chen ── */
#zone_chen_starter {
    display: flex;
    flex-direction: column;
    align-items: center;
    /* Centre Chen et sa bulle verticalement */
    width: 100%;
}

@media (min-width: 768px) {
    #zone_chen_starter {
        flex-direction: row;
        justify-content: center;
        align-items: flex-end;
    }
}



/* ── Choix des générations (Alignement Horizontal & Centré) ── */
#grille_starters {
    display: flex;
    flex-direction: row;
    /* Force l'alignement sur une ligne */
    flex-wrap: wrap;
    /* Permet de revenir à la ligne proprement sur mobile */
    justify-content: center;
    /* Centre tout le groupe horizontalement */
    align-items: center;
    /* Aligne le bouton Retour et les cartes verticalement */
    gap: 20px;
    width: 100%;
    max-width: 950px;
    /* Augmenté pour laisser de la place au bouton + 3 cartes */
    margin: 30px auto;
}

/* Style spécifique pour le bouton Retour dans la grille */
#grille_starters button {
    padding: 12px 20px;
    font-size: 10px;
    height: fit-content;
    margin: 0;
    /* Supprime les marges parasites */
}

/* S'assurer que les cartes de Pokémon ne sont pas trop larges */
.carte_caractere {
    flex-shrink: 0;
    /* Empêche les cartes de s'écraser */
}

/* ── Écran d'Authentification ── */
#authentification {
    display: flex;
    flex-direction: column;
    align-items: center;
    /* Centre tout horizontalement */
    justify-content: center;
    /* Centre tout verticalement */
    gap: 15px;
    /* Espace réduit entre l'input et le bouton */
    width: 100%;
    min-height: 100vh;
}

#input_prenom {
    width: 100%;
    max-width: 300px;
    margin: 0;
    /* On retire le margin: 0 auto car le parent est déjà en align-items: center */
    text-align: center;
    padding: 15px;
    font-family: 'Press Start 2P', cursive;
    /* ... tes autres styles ... */
}

#authentification button {
    margin: 0;
    /* On supprime le margin-top pour ne garder que le gap de 15px */
    width: fit-content;
    /* Le bouton ne prend que la place nécessaire */
}

/* ── Grille des Générations ── */
#grille_starters {
    display: flex;
    flex-direction: row;
    /* Force l'alignement horizontal */
    flex-wrap: nowrap;
    /* Empêche le retour à la ligne sur PC */
    justify-content: center;
    /* Centre le groupe de boutons */
    align-items: center;
    /* Aligne le bouton Retour et les Pokémon sur la même ligne */
    gap: 20px;
    width: 100%;
    max-width: 900px;
    /* Augmenté pour laisser assez de place aux 4 éléments */
    margin: 30px auto;
}

/* On s'assure que le bouton retour n'ait pas de marge qui décale l'alignement */
#grille_starters button {
    margin: 0;
    flex-shrink: 0;
    /* Empêche le bouton de rétrécir si la fenêtre est petite */
}

/* Responsive : On permet le retour à la ligne uniquement sur petit mobile */
@media (max-width: 600px) {
    #grille_starters {
        flex-wrap: wrap;
    }
}

#grille_starters {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    /* Autorise le passage à la ligne */
    justify-content: center;
    /* Garde le tout centré */
    gap: 15px;
    /* Espace entre les boutons */
    width: 90%;
    /* S'adapte à l'écran */
    max-width: 550px;
    /* Largeur limitée pour forcer des lignes de 3 ou 4 boutons */
    margin: 20px auto;
    /* Centrage horizontal du bloc */
}

#grille_starters button {
    flex: 0 1 120px;
    /* Largeur de base de 120px, peut rétrécir si besoin */
    min-width: 120px;
}

/* ── Barre de recherche (input + bouton OK côte à côte) ── */
.zone_recherche {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    max-width: 400px;
}

.zone_recherche #input_recherche {
    flex: 1;
    max-width: none;
    /* annule le max-width standalone */
    margin: 0;
}

.zone_recherche #ok_recherche {
    padding: 12px 16px;
    font-size: 11px;
    flex-shrink: 0;
}

.type {
    animation: typing 4s steps(20) infinite,
    blink .6s infinite;

}

#loading_screen {
    position: fixed;
    inset: 0;
    background: #1a1a2e;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999999;
    transition: opacity 0.5s ease;
}

#loading_inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

#loading_ball {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

#loading_text {
    font-family: 'Press Start 2P', cursive;
    font-size: 10px;
    color: #F5D44A;
    text-shadow: 2px 2px 0 #C9A800;
    letter-spacing: 1px;
}

#loading_bar_bg {
    width: 200px;
    height: 8px;
    background: rgba(255,255,255,0.1);
    border-radius: 4px;
    overflow: hidden;
}

#loading_bar {
    height: 100%;
    width: 0%;
    background: #F5D44A;
    border-radius: 4px;
    transition: width 0.3s ease;
}