/* ============================================
   MEMORY PICTOGRAMMES - CSS PRINCIPAL
   NextGN Formation - Gamified Design
   ============================================ */

:root {
    /* NextGN Base Colors */
    --teal: #0F6E56;
    --teal-mid: #1D9E75;
    --teal-light: #E1F5EE;
    --teal-dark: #085041;
    --amber: #BA7517;
    --amber-light: #FAEEDA;
    --amber-dark: #633806;
    --coral: #993C1D;
    --coral-mid: #D85A30;
    --coral-light: #FAECE7;
    --purple: #534AB7;
    --purple-light: #EEEDFE;
    --purple-dark: #3C3489;
    --blue: #185FA5;
    --blue-light: #E6F1FB;
    --bg: #F7F6F2;
    --white: #FFFFFF;
    --text: #1a1a18;
    --text-muted: #6b6a65;
    --border: rgba(0,0,0,0.1);
    
    /* Gamification Colors */
    --success: #4CAF50;
    --warning: #FF9800;
    --info: #2196F3;
    --accent: #FFD700;
    
    /* Shadows */
    --shadow-sm: 0 4px 8px rgba(15, 110, 86, 0.1);
    --shadow-md: 0 8px 16px rgba(15, 110, 86, 0.15);
    --shadow-lg: 0 16px 32px rgba(15, 110, 86, 0.25);
}

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

html, body {
    height: 100%;
}

body {
    font-family: 'DM Sans', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    overflow-x: hidden;
}

/* ============================================
   HEADER & NAVIGATION
   ============================================ */
.nav-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 70px;
    background: rgba(255, 255, 255, 0.95);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 40px;
    z-index: 1000;
    backdrop-filter: blur(10px);
}

.header-logo {
    font-family: 'Syne', sans-serif;
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.5px;
    background: linear-gradient(135deg, var(--teal-mid), var(--coral-mid));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-decoration: none;
}

.header-nav {
    display: flex;
    gap: 0;
}

.header-nav a {
    font-family: 'Syne', sans-serif;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
    text-decoration: none;
    margin-left: 40px;
    transition: color 0.3s ease;
    position: relative;
}

.header-nav a:hover {
    color: var(--teal-mid);
}

.header-nav a::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--teal-mid);
    transition: width 0.3s ease;
}

.header-nav a:hover::after {
    width: 100%;
}

/* ============================================
   PROGRESS BAR
   ============================================ */
.progress {
    position: fixed;
    top: 70px;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--teal-light);
    z-index: 999;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--teal-mid), var(--teal-dark));
    width: 0%;
    transition: width 0.2s ease;
}

/* ============================================
   MAIN LAYOUT
   ============================================ */
main {
    margin-top: 70px;
    padding: 40px;
    min-height: calc(100vh - 70px);
}

.game-container {
    max-width: 1200px;
    margin: 0 auto;
}

/* ============================================
   INTRO SECTION
   ============================================ */
.intro-section {
    margin-bottom: 60px;
    animation: fadeInDown 0.6s ease-out;
}

.intro-section h1 {
    font-family: 'Syne', sans-serif;
    font-size: clamp(28px, 5vw, 48px);
    font-weight: 800;
    color: var(--teal);
    margin-bottom: 8px;
    text-align: center;
}

.intro-section .subtitle {
    font-size: 18px;
    color: var(--text-muted);
    text-align: center;
    margin-bottom: 24px;
    font-weight: 300;
}

.intro-box {
    background: linear-gradient(135deg, var(--teal-light), var(--white));
    border-left: 4px solid var(--teal-mid);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 32px;
    font-size: 0.95em;
    color: var(--text-muted);
    line-height: 1.6;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
    text-align: center;
}

/* ============================================
   DIFFICULTY SELECTOR
   ============================================ */
.difficulty-selector {
    margin-bottom: 48px;
    text-align: center;
    animation: fadeInUp 0.6s ease-out 0.2s both;
}

.difficulty-selector label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin-bottom: 16px;
}

.btn-group {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 12px;
    max-width: 500px;
    margin: 0 auto;
}

.btn-difficulty {
    background: var(--white);
    border: 2px solid var(--teal-light);
    border-radius: 8px;
    padding: 16px 12px;
    font-family: 'Syne', sans-serif;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.btn-difficulty:hover {
    border-color: var(--teal-mid);
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}

.btn-difficulty.active {
    background: linear-gradient(135deg, var(--teal-light), var(--white));
    border-color: var(--teal-mid);
    color: var(--teal);
}

.btn-label {
    font-size: 14px;
    font-weight: 700;
    color: var(--teal);
}

.btn-desc {
    font-size: 12px;
    font-family: 'DM Sans', sans-serif;
    color: var(--text-muted);
    font-weight: 400;
}

/* ============================================
   GAME SECTION
   ============================================ */
.game-section {
    margin-bottom: 80px;
    animation: fadeInUp 0.6s ease-out 0.3s both;
}

/* ============================================
   GAME GRID & CARDS
   ============================================ */
.game-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(clamp(70px, 15vw, 140px), 1fr));
    gap: clamp(12px, 2vw, 20px);
    max-width: 900px;
    margin: 0 auto 40px;
    padding: 20px;
    background: linear-gradient(135deg, rgba(225, 245, 238, 0.4), transparent);
    border-radius: 16px;
    border: 1px solid var(--teal-light);
}

/* MEMORY CARD STYLES */
.memory-card {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    cursor: pointer;
    perspective: 1000px;
    transform-style: preserve-3d;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    border-radius: 12px;
    overflow: hidden;
}

/* Card Front (Couverture) */
.card-face {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    font-weight: bold;
    font-family: 'Syne', sans-serif;
    font-size: clamp(32px, 8vw, 56px);
}

.card-face.front {
    background: linear-gradient(135deg, var(--teal-light), var(--teal-light));
    border: 2px solid var(--teal-mid);
    color: var(--teal-dark);
    box-shadow: var(--shadow-sm);
}

.card-face.back {
    transform: rotateY(180deg);
    background: linear-gradient(135deg, var(--white), var(--teal-light));
    border: 2px solid var(--teal-mid);
    flex-direction: column;
    gap: 8px;
    padding: 8px;
    box-shadow: var(--shadow-sm);
}

.card-face.back img {
    max-width: 70%;
    max-height: 60%;
    object-fit: contain;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

.card-face.back span {
    font-size: clamp(10px, 2vw, 13px);
    text-align: center;
    font-weight: 500;
    line-height: 1.2;
    color: var(--text);
    font-family: 'DM Sans', sans-serif;
}

/* Card States */
.memory-card:hover:not(.matched):not(.disabled) {
    transform: translateY(-8px) scale(1.05);
    box-shadow: var(--shadow-lg);
}

.memory-card.flipped .card-face.front {
    transform: rotateY(180deg);
}

.memory-card.flipped .card-face.back {
    transform: rotateY(0deg);
}

.memory-card.matched {
    animation: matchSuccess 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
    cursor: default;
}

.memory-card.matched .card-face.front {
    background: linear-gradient(135deg, var(--success), var(--success));
    border-color: var(--success);
    color: var(--white);
}

.memory-card.matched .card-face.back {
    background: linear-gradient(135deg, var(--white), rgba(76, 175, 80, 0.2));
    border-color: var(--success);
}

.memory-card.error {
    animation: cardShake 0.4s ease-in-out;
}

.memory-card.disabled {
    pointer-events: none;
}

/* ============================================
   FOOTER
   ============================================ */
footer {
    background: var(--text);
    color: var(--white);
    padding: 40px;
    text-align: center;
    font-size: 13px;
    margin-top: 80px;
}

/* ============================================
   BUTTONS
   ============================================ */
.btn {
    font-family: 'Syne', sans-serif;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--teal-mid), var(--teal-dark));
    color: var(--white);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-secondary {
    background: var(--white);
    border: 2px solid var(--teal-mid);
    color: var(--teal-mid);
}

.btn-secondary:hover {
    background: var(--teal-light);
    border-color: var(--teal-dark);
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */
@media (max-width: 768px) {
    .nav-header {
        padding: 0 20px;
    }
    
    .header-nav a {
        margin-left: 20px;
        font-size: 11px;
    }
    
    main {
        padding: 20px;
        margin-top: 70px;
    }
    
    .intro-section h1 {
        font-size: 28px;
    }
    
    .game-grid {
        gap: 12px;
        padding: 16px;
    }
    
    .game-controls {
        flex-direction: column;
        gap: 8px;
    }
    
    .game-controls .btn {
        width: 100%;
        justify-content: center;
    }
    
    footer {
        padding: 24px;
        font-size: 12px;
    }
}

@media (max-width: 480px) {
    .nav-header {
        height: 60px;
        padding: 0 16px;
    }
    
    .header-logo {
        font-size: 16px;
    }
    
    .header-nav a {
        margin-left: 12px;
        font-size: 10px;
    }
    
    main {
        padding: 16px;
        margin-top: 60px;
    }
    
    .intro-section h1 {
        font-size: 24px;
    }
    
    .difficulty-selector label {
        font-size: 12px;
    }
    
    .btn-group {
        grid-template-columns: 1fr;
    }
    
    .game-hud {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
}
