* {
    box-sizing: border-box;
    user-select: none;
    margin: 0;
    padding: 0;
}

body {
    background: linear-gradient(145deg, #1e293b 0%, #0f172a 100%);
    min-height: 100vh;
    font-family: 'Segoe UI', 'Poppins', system-ui, sans-serif;
    margin: 0;
    padding: 0;
}

/* ========== BARRE DE NAVIGATION ========== */
.main-nav {
    background: linear-gradient(135deg, #1e293b, #0f172a);
    padding: 0.8rem 2rem;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    width: 100%;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.5rem;
    font-weight: bold;
    color: #facc15;
}

.logo-icon { font-size: 1.8rem; }
.logo-text { font-size: 1.2rem; }

.nav-menu {
    display: flex;
    list-style: none;
    gap: 1.5rem;
    margin: 0;
    padding: 0;
}

.nav-link {
    color: white;
    text-decoration: none;
    font-size: 1rem;
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: 30px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-link:hover { background: rgba(255,255,255,0.1); transform: translateY(-2px); }
.nav-link.active { background: linear-gradient(135deg, #f59e0b, #d97706); color: white; }

.nav-toggle { display: none; flex-direction: column; cursor: pointer; }
.nav-toggle .bar { width: 25px; height: 3px; background: white; margin: 3px 0; transition: 0.3s; border-radius: 3px; }

/* ========== LANGUE ========== */
.language-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    animation: fadeIn 0.5s ease;
}

.language-container {
    background: rgba(255,255,255,0.95);
    border-radius: 64px;
    padding: 50px 40px;
    text-align: center;
    max-width: 90%;
    width: 800px;
    animation: slideUp 0.5s ease;
}

.language-title { font-size: 3rem; color: #4a5568; margin-bottom: 15px; }
.language-subtitle { font-size: 1.1rem; color: #718096; margin-bottom: 40px; }
.language-buttons { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px,1fr)); gap: 15px; }

.lang-btn {
    background: linear-gradient(135deg, #667eea, #764ba2);
    border: none;
    padding: 15px 20px;
    border-radius: 60px;
    font-size: 1.1rem;
    font-weight: bold;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}
.lang-btn:hover { transform: translateY(-3px); }
.lang-flag { font-size: 1.5rem; }

/* ========== JEU ========== */
.game-screen { width: 100%; min-height: 100vh; display: flex; flex-direction: column; }
.game-screen.hidden { display: none; }
.game-container {
    background: rgba(255,255,255,0.1);
    backdrop-filter: blur(4px);
    border-radius: 64px;
    padding: 24px 20px 32px;
    margin: 20px;
}
.page-wrapper { flex: 1; display: flex; justify-content: center; align-items: center; }

.dashboard {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    background: #0f172ad9;
    padding: 12px 28px;
    border-radius: 60px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}
.level-info { display: flex; gap: 15px; flex-wrap: wrap; }
.level-badge { background: linear-gradient(135deg, #f59e0b, #d97706); padding: 6px 18px; border-radius: 40px; }
.attempt-counter { background: #2d3a5e; padding: 6px 18px; border-radius: 40px; color: #facc15; }
.sound-controls { display: flex; gap: 10px; }
.sound-btn { background: #334155; border: none; font-size: 1.3rem; padding: 6px 14px; border-radius: 40px; cursor: pointer; }

.victory-message { background: #10b981; padding: 6px 20px; border-radius: 40px; }
.victory-message.hidden { background: #334155; opacity: 0.6; }

.level-name { background: rgba(0,0,0,0.5); padding: 8px 24px; border-radius: 40px; color: #ffd966; text-align: center; margin-bottom: 20px; display: inline-block; width: auto; }

.memory-grid { display: grid; gap: 14px; justify-content: center; margin: 0 auto; }
.memory-grid.grid-4x4 { grid-template-columns: repeat(4, minmax(75px, 100px)); }
.memory-grid.grid-6x6 { grid-template-columns: repeat(6, minmax(70px, 85px)); }
.memory-grid.grid-8x8 { grid-template-columns: repeat(8, minmax(65px, 75px)); }

.card {
    aspect-ratio: 1;
    background: linear-gradient(145deg, #8b5cf6, #4f46e5);
    border-radius: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    transition: all 0.25s;
    box-shadow: 0 12px 18px -6px rgba(0,0,0,0.5);
}
.card.flipped { background: linear-gradient(135deg, #3b82f6, #2563eb); transform: scale(0.98); }
.card.matched { background: linear-gradient(145deg, #10b981, #047857); cursor: default; }
.card.disabled { pointer-events: none; }

.game-buttons { display: flex; gap: 15px; justify-content: center; margin-top: 28px; flex-wrap: wrap; }
.reset-btn {
    background: #f97316;
    border: none;
    font-size: 1rem;
    font-weight: bold;
    padding: 10px 20px;
    border-radius: 40px;
    color: white;
    cursor: pointer;
    box-shadow: 0 5px 0 #9b2c1d;
}
.reset-level-btn { background: #3b82f6; box-shadow: 0 5px 0 #1e40af; }

.game-footer {
    width: 100%;
    padding: 20px;
    text-align: center;
    background: rgba(0,0,0,0.4);
    border-top: 1px solid rgba(255,255,255,0.1);
}
.footer-content p { margin: 5px 0; font-size: 12px; color: #94a3b8; }

/* ========== PAGES INFO ========== */
.info-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.95);
    backdrop-filter: blur(10px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    overflow-y: auto;
}
.info-screen.hidden { display: none; }
.info-container {
    background: linear-gradient(135deg, #1e293b, #0f172a);
    border-radius: 32px;
    max-width: 800px;
    width: 90%;
    max-height: 85vh;
    overflow-y: auto;
    padding: 30px;
}
.info-title { font-size: 2rem; text-align: center; color: #facc15; margin-bottom: 25px; }
.info-section { margin-bottom: 25px; padding-bottom: 15px; border-bottom: 1px solid rgba(255,255,255,0.1); }
.info-section h2 { color: #facc15; font-size: 1.3rem; margin-bottom: 12px; }
.info-section p, .info-section li { color: #cbd5e1; line-height: 1.6; }
.close-info-btn {
    width: 100%;
    background: linear-gradient(135deg, #f59e0b, #d97706);
    border: none;
    padding: 12px;
    border-radius: 40px;
    font-size: 1rem;
    font-weight: bold;
    color: white;
    cursor: pointer;
}

/* ========== ANIMATIONS ========== */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(50px); } to { opacity: 1; transform: translateY(0); } }

/* ========== RESPONSIVE ========== */
@media (max-width: 768px) {
    .nav-toggle { display: flex; }
    .nav-menu {
        position: fixed;
        left: -100%;
        top: 60px;
        flex-direction: column;
        background: linear-gradient(135deg, #1e293b, #0f172a);
        width: 100%;
        text-align: center;
        transition: 0.3s;
        padding: 20px 0;
        gap: 15px;
        z-index: 999;
    }
    .nav-menu.active { left: 0; }
    .nav-toggle.active .bar:nth-child(2) { opacity: 0; }
    .nav-toggle.active .bar:nth-child(1) { transform: translateY(8px) rotate(45deg); }
    .nav-toggle.active .bar:nth-child(3) { transform: translateY(-8px) rotate(-45deg); }
    .language-title { font-size: 2rem; }
    .language-buttons { grid-template-columns: 1fr; }
}

@media (max-width: 620px) {
    .memory-grid.grid-6x6 { grid-template-columns: repeat(6, minmax(50px, 65px)); gap: 8px; }
    .memory-grid.grid-4x4 { grid-template-columns: repeat(4, minmax(60px, 70px)); gap: 8px; }
    .card { font-size: 1.6rem; }
}

@media (max-width: 520px) {
    .dashboard { padding: 8px 16px; }
    .level-badge, .attempt-counter { font-size: 0.9rem; padding: 4px 12px; }
    .reset-btn { font-size: 0.8rem; padding: 8px 12px; }
}