:root {
    --bg-dark: #0f0f11;
    --bg-card: #18181b;
    --primary: #3b82f6; /* Bleu électrique */
    --accent: #6366f1; /* Violet */
    --text-main: #ffffff;
    --text-muted: #a1a1aa;
    --danger: #ef4444;
    --success: #10b981;
    --nav-height: 70px;
    --glass: rgba(20, 20, 23, 0.85);
    --radius: 12px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Inter', sans-serif;
    -webkit-font-smoothing: antialiased;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    overflow-x: hidden; /* Empêche le scroll horizontal */
}

body.locked {
    overflow: hidden;
}

/* =========================================
   1. LOGIN & NUMPAD
   ========================================= */

.login-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: #000;
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: opacity 0.5s ease, visibility 0.5s;
}

.login-overlay.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.login-bg-anim {
    position: absolute;
    width: 100%; height: 100%;
    background: radial-gradient(circle at 50% 50%, #1e1b4b 0%, #000 70%);
    z-index: -1;
    opacity: 0.6;
}

.login-box {
    text-align: center;
    width: 100%;
    max-width: 340px;
    padding: 30px;
}

.login-header h1 {
    font-weight: 800;
    font-size: 2.5rem;
    letter-spacing: 2px;
    margin-bottom: 20px;
    background: linear-gradient(to right, #fff, #94a3b8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.error-msg {
    color: var(--danger);
    margin-top: 10px;
    font-size: 0.9rem;
    display: none;
    height: 20px;
}

/* --- PAVÉ NUMÉRIQUE (NUMPAD) --- */
.numpad {
    margin-top: 25px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    justify-content: center;
    align-items: center;
}

.num-row {
    display: flex;
    gap: 20px;
}

.numpad button {
    width: 65px;
    height: 65px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.03);
    color: white;
    font-size: 1.6rem;
    font-weight: 400;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    outline: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.numpad button:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
    transform: scale(1.05);
}

.numpad button:active {
    transform: scale(0.95);
    background: var(--primary);
    border-color: var(--primary);
}

.numpad button.action-btn {
    background: transparent;
    border-color: transparent;
    font-size: 1.3rem;
}

.numpad button.delete { color: var(--danger); }
.numpad button.go { color: var(--success); }

/* Input Readonly stylisé */
#login-pass {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 12px;
    color: white;
    font-size: 2rem;
    text-align: center;
    width: 100%;
    padding: 10px;
    letter-spacing: 15px;
    pointer-events: none; /* Bloque le clavier virtuel natif */
    font-family: monospace;
}

/* =========================================
   2. NAVBAR (Desktop & Mobile Unifiés)
   ========================================= */

.navbar {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: var(--nav-height);
    background: rgba(15, 15, 17, 0.90); /* Légèrement transparent */
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(255,255,255,0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    z-index: 1000;
}

/* --- LOGO --- */
.nav-left {
    flex-shrink: 0; /* Ne rétrécit jamais */
    margin-right: 15px;
}

.brand {
    font-weight: 800;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    gap: 10px;
    color: white;
    cursor: pointer;
}

/* --- RECHERCHE (Centre) --- */
.nav-center {
    flex: 1; /* Prend toute la place disponible */
    display: flex;
    justify-content: center;
    max-width: 500px; /* Pas trop large sur PC */
}

.search-wrapper {
    position: relative;
    width: 100%;
}

.search-wrapper i {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 0.9rem;
    pointer-events: none; /* Laisse passer le clic vers l'input */
}

#search-input {
    width: 100%;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    padding: 10px 10px 10px 40px;
    border-radius: 50px;
    color: white;
    outline: none;
    transition: all 0.3s;
    font-size: 16px; /* Évite le zoom auto sur iPhone */
}

#search-input:focus {
    background: rgba(255,255,255,0.1);
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
}

/* --- BOUTONS (Droite) --- */
.nav-right {
    flex-shrink: 0; /* Ne rétrécit jamais */
    display: flex;
    gap: 8px;
    margin-left: 15px;
}

.nav-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 10px; /* Zone de clic confortable */
    border-radius: 8px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-weight: 600;
}

.nav-btn i {
    font-size: 1.1rem;
}

.nav-btn:hover, .nav-btn:active {
    color: white;
    background: rgba(255,255,255,0.1);
}

.nav-btn.secondary:hover { color: var(--danger); }

/* --- ADAPTATION MOBILE (Responsive) --- */
@media (max-width: 768px) {
    .navbar {
        padding: 0 10px; /* Marges réduites */
        height: 65px; /* Un peu plus compact */
    }

    /* 1. On cache le texte du Logo "NEXUS" */
    .brand span {
        display: none;
    }
    
    .brand i {
        font-size: 1.4rem;
        color: var(--primary);
    }

    /* 2. On cache le texte des boutons "Souhaits" */
    .desktop-text {
        display: none;
    }

    /* 3. Ajustement barre de recherche */
    #search-input {
        padding-left: 35px;
        height: 40px;
    }
    
    .search-wrapper i {
        left: 12px;
    }
    
    /* 4. Boutons plus gros pour le doigt mais sans texte */
    .nav-btn {
        padding: 8px;
        width: 40px;
        height: 40px;
    }
}

/* =========================================
   3. FILTERS (Avatars)
   ========================================= */

.app-container {
    padding-top: var(--nav-height);
    min-height: 100vh;
}

.filters-section {
    padding: 20px;
}

.filters-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 20px;
}

#filter-status {
    font-size: 0.9rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 5px;
}

.badges {
    display: flex;
    align-items: center;
    gap: 15px;
}

.count-badge {
    background: var(--primary);
    color: white;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 700;
}

.text-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.85rem;
    text-decoration: underline;
}

.avatars-scroll {
    display: flex;
    gap: 15px;
    overflow-x: auto;
    padding-bottom: 10px;
    scrollbar-width: none;
    /* Important pour mobile : Swipe fluide */
    -webkit-overflow-scrolling: touch; 
    scroll-behavior: smooth;
    padding-left: 2px; /* Fix coupure */
}

.avatars-scroll::-webkit-scrollbar { display: none; }

.avatar-wrapper {
    position: relative;
    cursor: pointer;
    transition: transform 0.2s;
    flex-shrink: 0;
}

.avatar-wrapper img {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: 2px solid transparent;
    transition: all 0.2s;
    object-fit: cover;
}

.avatar-wrapper:hover { transform: scale(1.1); }
.avatar-wrapper.active img {
    border-color: var(--primary);
    box-shadow: 0 0 15px rgba(59, 130, 246, 0.5);
}

/* =========================================
   4. GAME GRID (Slide Up Effect)
   ========================================= */

.content-area {
    padding: 0 20px 40px 20px;

}

.games-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.game-card {
    position: relative;
    background: var(--bg-card);
    border-radius: var(--radius);
    overflow: hidden;
    aspect-ratio: 16/9;
    cursor: pointer;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.game-bg {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94), filter 0.4s;
}

/* HOVER DESKTOP */
.game-card:hover {
    transform: translateY(-5px); /* Monte moins haut */
    z-index: 10;
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.4); /* Ombre plus diffuse */
}

.game-card:hover .game-bg {
    transform: scale(1.05); /* Zoom très léger (5% au lieu de 10%) */
    filter: brightness(0.7); /* Moins sombre qu'avant pour profiter de l'art */
}

/* INFOS (Titre + Propriétaires) - Caché par défaut */
.card-info {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    padding: 20px;
    background: linear-gradient(to top, rgba(0,0,0,0.95) 0%, rgba(0,0,0,0.6) 80%, transparent 100%);
    backdrop-filter: blur(4px); 
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    
    transform: translateY(110%); /* Caché en bas */
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.game-card:hover .card-info {
    transform: translateY(0);
    opacity: 1;
}

.card-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: white;
    margin-top: 8px;
    text-shadow: 0 2px 10px rgba(0,0,0,1);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.owners-row {
    display: flex;
    gap: -10px;
    margin-bottom: 5px;
    transform: translateX(-10px);
    opacity: 0;
    transition: all 0.5s ease 0.1s;
}

.game-card:hover .owners-row {
    transform: translateX(0);
    opacity: 1;
}

.owners-row .mini-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.8);
    margin-right: -8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.5);
}

.badge-new {
    position: absolute;
    top: 10px; right: 10px;
    background: var(--primary);
    color: white;
    font-size: 0.65rem;
    font-weight: 800;
    padding: 4px 8px;
    border-radius: 4px;
    z-index: 5;
    box-shadow: 0 2px 5px rgba(0,0,0,0.5);
}

/* =========================================
   5. POPUPS & WIDGETS
   ========================================= */

.wish-grid { display: flex; flex-direction: column; gap: 10px; max-height: 400px; overflow-y: auto; }
.wish-card { display: flex; background: #222; border-radius: 8px; overflow: hidden; position: relative; height: 70px; }
.wish-bg { width: 120px; object-fit: cover; mask-image: linear-gradient(to right, black 80%, transparent); -webkit-mask-image: linear-gradient(to right, black 80%, transparent); }
.wish-content { flex: 1; display: flex; flex-direction: column; justify-content: center; padding: 0 10px; }
.wish-title { font-weight: 600; font-size: 0.95rem; }
.wish-meta { display: flex; align-items: center; gap: 6px; font-size: 0.75rem; color: #888; margin-top: 4px; }
.wish-avatar { width: 16px; height: 16px; border-radius: 50%; }
.wish-delete { width: 40px; background: transparent; border: none; color: #555; cursor: pointer; transition: color 0.2s; }
.wish-delete:hover { color: var(--danger); }

.search-item { display: flex; align-items: center; gap: 10px; padding: 10px; border-bottom: 1px solid #333; cursor: pointer; transition: background 0.2s; }
.search-item:hover { background: rgba(255,255,255,0.05); }
.search-item img { width: 40px; border-radius: 4px; }

.new-games-carousel { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.mini-card { width: 120px; text-align: center; }
.mini-card img { width: 100%; border-radius: 6px; margin-bottom: 5px; }
.mini-card span { font-size: 0.7rem; color: #ccc; display: block; line-height: 1.2; }

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* =========================================
   6. RESPONSIVE MOBILE (MENU BURGER)
   ========================================= */



@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }


/* --- FIX SPECIAL IPHONE / IOS --- */

/* 1. Force la détection du clic sur iOS */
div[onclick], button, .game-card, .avatar-wrapper, .burger-btn {
    cursor: pointer; 
    touch-action: manipulation; /* Enlève le délai de 300ms au clic */
    -webkit-tap-highlight-color: transparent; /* Enlève le flash gris moche */
}

/* 2. GESTION DU MENU MOBILE (Le plus important) */
/* Quand le menu est FERMÉ : on le cache totalement pour que le doigt passe au travers */
.nav-content {
    visibility: hidden; /* INDISPENSABLE : Rend l'élément "inexistant" pour le tactile */
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.3s;
}

/* Quand le menu est OUVERT */
.nav-content.active {
    visibility: visible;
    transform: translateX(0);
}

/* 3. Sécurité Z-Index pour la grille */
.games-grid {
    position: relative;
    z-index: 1; /* S'assure que la grille est sur un calque actif */
}
/* ============================================================
   CORRECTION FINALE : RÉTABLIR LE MENU SUR ORDI
   ============================================================ */

/* 1. Sur PC (Écrans larges), on force tout à rester visible */
@media (min-width: 769px) {
    .nav-content {
        visibility: visible !important;
        transform: none !important;
        opacity: 1 !important;
        pointer-events: auto !important;
        
        /* On annule les styles mobiles (fond noir, position fixe...) */
        position: static !important;
        background: transparent !important;
        height: auto !important;
        width: auto !important;
        box-shadow: none !important;
        border-left: none !important;
        padding: 0 !important;
    }

    /* On cache le burger sur PC */
    .burger-btn {
        display: none !important;
    }
}

/* 2. Sur MOBILE uniquement, on applique la règle "Invisible" */
@media (max-width: 768px) {
    .nav-content {
        visibility: hidden; /* Caché par défaut pour le tactile */
    }
    
    .nav-content.active {
        visibility: visible; /* Visible quand on clique sur burger */
    }
}

#reset-filters {
    /* 1. On casse le style "moche" d'avant */
    text-decoration: none !important; /* Retire le soulignement */
    background: rgba(255, 255, 255, 0.05); /* Fond vitré léger */
    border: 1px solid rgba(255, 255, 255, 0.1); /* Bordure fine */
    
    /* 2. On lui donne une belle forme */
    padding: 10px 20px;
    border-radius: 50px; /* Bords totalement ronds */
    color: #a1a1aa; /* Gris clair élégant */
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px; /* Espacement des lettres "PRO" */
    

}

.section-title {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: 2px;
    padding-right: 20px;
    color: white;
    margin: 0;
    /* Petit dégradé sur le texte pour l'effet premium */
    background: linear-gradient(to right, #fff, #94a3b8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Ajustement mobile pour aligner le titre et le bouton */
@media (max-width: 768px) {
    .filters-header {
        flex-direction: row; /* On remet en ligne sur mobile */
        align-items: center;
        justify-content: space-between;
        margin-bottom: 15px;
    }
    
    .section-title {
        font-size: 1.2rem; /* Un peu plus petit sur mobile */
    }
    
    /* On cache le texte "Effacer le filtre" sur mobile pour gagner de la place, on garde l'icône */
    #reset-filters span {
        display: none; 
    }
    #reset-filters {
        padding: 8px 12px; /* Bouton plus carré */
    }
}