/* ===============================
    Global Styles 
=============================== */
* {
    box-sizing: border-box;
    /* Empêche le highlight bleu au clic sur mobile */
    -webkit-tap-highlight-color: transparent;
}

html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden; /* Coupe tout ce qui dépasse */
    overscroll-behavior: none; /* Bloque l'effet élastique (rebond) */
    position: fixed; /* Fixe la page pour empêcher le scroll iOS */
}

body {
    font-family: 'Poppins', sans-serif;
    background-color: #1a1a1a;
    color: white;
    display:  flex;
    justify-content: center;
    align-items: center;
}

h1 {
    margin-bottom:  20px;
    font-size: 2.2em;
    text-align: center;
    color: #ff7f50;
    text-shadow:  0 0 8px #ff7f50;
}

/* ===============================
    Container Styles 
=============================== */
#main-container {
    display: flex;
    flex-direction: column;
    gap: 40px;
    width: 800px;
}

/* ===============================
    Profile Selection 
=============================== */
#profiles-container {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 30px;
}

.profile {
    background-color:  #2c2c2c;
    border: 2px solid transparent;
    border-radius:  10px;
    padding:  20px;
    text-align:  center;
    cursor: pointer;
    font-size: 1.2em;
    transition: transform 0.3s, border-color 0.3s;
    width: 180px;
    min-height: 80px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.profile:hover,
.profile.keyboard-focus {
    transform: scale(1.05);
    border-color: #ff7f50;
}

.profile.selected {
    animation: neon-glow 1. 5s infinite alternate;
    box-shadow: 0 0 15px var(--glow-color), 0 0 30px var(--glow-color);
}

.empty {
    opacity: 0.4;
}

/* ===============================
    Game Mode Selection 
=============================== */
#game-modes {
    display: flex;
    justify-content: space-around;
}

.game-mode {
    background-color: #2c2c2c;
    border:  2px solid transparent;
    border-radius: 10px;
    padding: 20px;
    text-align: center;
    cursor: pointer;
    font-size: 1.2em;
    transition: transform 0.3s, border-color 0.3s;
    margin: 10px;
}

/* Effet de néon au survol */
.game-mode:hover {
    transform: scale(1.05);
    border-color: #ff7f50;
    box-shadow: 0 0 6px #ff7f50, 0 0 12px #ff7f50;
}

/* Effet de sélection avec néon */
.game-mode.selected {
    animation: neon-glow-mode 2s infinite alternate;
}

.game-mode.keyboard-focus {
    transform: scale(1.05);
    border-color: #ff7f50;
}

/* ===============================
    Buttons
=============================== */
button {
    padding: 10px 20px;
    font-size: 1.1em;
    background-color: #ff7f50;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s, transform 0.2s;
    margin: 5px;
    margin-top: 20px;
}

button:hover {
    background-color: #ff9966;
    transform: scale(1.05);
}

button:active {
    transform:  scale(0.98);
}

/* ===============================
    Animations
=============================== */
/* Animation plus douce pour le néon */
@keyframes neon-glow-mode {
    0%,
    100% {
        box-shadow: 0 0 5px var(--glow-color-mode), 0 0 10px var(--glow-color-mode), 0 0 15px var(--glow-color-mode);
    }

    50% {
        box-shadow: 0 0 10px var(--glow-color-mode), 0 0 20px var(--glow-color-mode), 0 0 30px var(--glow-color-mode);
    }
}

/* Animation pour les profils */
@keyframes neon-glow {
    0%,
    100% {
        box-shadow: 0 0 5px var(--glow-color), 0 0 10px var(--glow-color), 0 0 15px var(--glow-color);
    }

    50% {
        box-shadow: 0 0 10px var(--glow-color), 0 0 20px var(--glow-color), 0 0 30px var(--glow-color);
    }
}

/* ===============================
    RESPONSIVE DESIGN - MOBILE
=============================== */

/* Mobile (< 768px) */
@media (max-width: 767px) {
    /* Main container takes full space but respects padding */
    #main-container {
        width: 100%;
        height: 100%;
        max-width: none;
        padding: 15px;
        
        display: flex;
        flex-direction: column;
        justify-content: center; /* Centre verticalement */
        align-items: stretch; /* Étire les enfants en largeur */
        gap: 15px;
    }
    
    /* Title adjustment */
    h1 {
        font-size: 1.4em;
        margin: 0; /* Supprime les marges par défaut qui causent le scroll */
        text-align: center;
        flex-shrink: 0;
    }

    /* Logo wrapper adjustment */
    .logo-wrapper {
        flex-shrink: 0;
        margin-bottom: 10px;
    }
    
    /* Logo responsive */
    .game-logo {
        width: 90%; /* Prend plus de largeur */
        max-width: 300px; /* Agrandissement du logo */
        margin: 0 auto;
        display: block;
    }
    
    /* Profile Section - The only scrollable part */
    .profile-selection {
        flex: 1; /* Prend l'espace disponible restant */
        min-height: 0; /* Important pour que le flex scroll fonctionne */
        display: flex;
        flex-direction: column;
        overflow: hidden; /* Empêche la section elle-même de déborder */
    }

    .profile-selection h1 {
        font-size: 1em;
        margin-bottom: 10px;
    }

    #profiles-container {
        display: flex;
        flex-direction: column;
        gap: 10px;
        width: 100%;
        
        /* SCROLL INTERNE VERTICAL UNIQUEMENT */
        overflow-y: auto;
        overflow-x: hidden; /* Bloque le mouvement horizontal */
        overscroll-behavior: contain;
        
        /* Padding pour le contenu scrollable */
        padding: 5px; 
        flex: 1;
    }
    
    .profile {
        width: 100%;
        padding: 15px;
        min-height: 60px;
        flex-shrink: 0;
        /* Désactiver le zoom au clic sur mobile pour éviter le débordement */
        transform: none !important; 
        transition: border-color 0.3s; /* On garde juste la couleur */
    }
    
    .profile:hover, .profile.keyboard-focus {
        transform: none !important; /* Surcharge le hover global */
    }
    
    /* Buttons area */
    #load-profile, #delete-profile, #import-save-btn {
        flex-shrink: 0;
        min-height: 44px;
        padding: 10px;
        font-size: 0.9em;
        width: 100%;
        margin: 5px 0 0 0;
    }
}

/* Tablet (768px - 1023px) */
@media (min-width: 768px) and (max-width: 1023px) {
    #main-container {
        width: 95%;
        max-width: 800px;
    }
    
    #profiles-container {
        grid-template-columns: repeat(3, 1fr);
        gap: 20px;
    }
    
    .profile {
        width: 100%;
    }
}

/* Desktop (1024px+) - Preserve original layout */
@media (min-width: 1024px) {
    #main-container {
        width: 800px;
    }
    
    #profiles-container {
        grid-template-columns: repeat(4, 1fr);
        gap: 30px;
    }
    
    .profile {
        width: 180px;
    }
}