/* ==============================
   Reset minimal et fond global
   ============================== */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: Arial, Helvetica, sans-serif;
    background: linear-gradient(to right, #b993d6, #8ca6db);
}


/* ==============================
   Grille responsive
   ============================== */
.memory-grid {
    display: grid;
    gap: 15px;
    justify-items: center;
    grid-template-columns: repeat(4, 1fr); /* 4 colonnes par défaut */
}

@media (max-width: 900px) {
    .memory-grid {
        grid-template-columns: repeat(3, 1fr); /* 3 colonnes sur tablettes */
    }
}

@media (max-width: 600px) {
    .memory-grid {
        grid-template-columns: repeat(2, 1fr); /* 2 colonnes sur mobiles */
    }
}

/* ==============================
   Cartes Memory
   ============================== */
.memory-card {
    width: 100%;
    aspect-ratio: 1/1; /* toujours carré */
    perspective: 1000px;
    cursor: pointer;
    position: relative;
}

.card-inner {
    width: 100%;
    height: 100%;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.6s;
}

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

/* ==============================
   Faces de la carte
   ============================== */
.card-front,
.card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
    backface-visibility: hidden;
    pointer-events: none; /* clic passe à la memory-card */
}

.card-front {
    background: #007bff; /* couleur dos */
}

.card-back {
    transform: rotateY(180deg);
    background-color: white; /* Fond uni derrière l'image */
    display: flex;
    justify-content: center;
    align-items: center;
}

/* ==============================
   Image centrée
   ============================== */
.card-back img {
    width: 100%;
    height: 100%;
    object-fit: contain; /* garde les proportions */
    display: block;
    margin: 0 auto;
    background: none;
    border-radius: 0;
    pointer-events: none; /* clic ne bloque pas le flip */
    user-select: none;
}

/* ==============================
   CONTENEUR DU JEU
   ============================== */

.memory-game-wrapper {
    width: 90%;
    max-width: 900px;

    margin: 30px auto;
}


/* ==============================
   PANNEAU DES STATISTIQUES
   ============================== */

.memory-stats {
    width: 100%;

    display: flex;
    align-items: stretch;

    margin-bottom: 20px;
    padding: 18px;

    background: linear-gradient(
        145deg,
        #4a4a4a,
        #111111
    );

    border: 3px solid #777;
    border-radius: 15px;

    box-shadow:
        0 8px 20px rgba(0, 0, 0, 0.5),
        inset 0 0 15px rgba(255, 255, 255, 0.08);
}


/* ==============================
   STATISTIQUE
   ============================== */

.digital-stat {
    flex: 1;

    text-align: center;

    padding: 5px 20px;
}


/* Séparateurs entre les statistiques */

.digital-stat + .digital-stat {
    border-left: 1px solid #555;
}


/* ==============================
   LABEL
   ============================== */

.digital-label {
    margin-bottom: 8px;

    color: #dddddd;

    font-size: 14px;
    font-weight: bold;

    letter-spacing: 3px;
}


/* ==============================
   AFFICHEUR DIGITAL
   ============================== */

.digital-display {
    display: inline-block;

    min-width: 150px;

    padding: 8px 15px;

    background: #050505;

    border: 2px solid #222;
    border-radius: 7px;

    color: #ff2b2b;

    font-family: monospace;

    font-size: 42px;
    font-weight: bold;

    letter-spacing: 5px;

    text-shadow:
        0 0 5px #ff0000,
        0 0 10px #ff0000,
        0 0 20px rgba(255, 0, 0, 0.8);

    box-shadow:
        inset 0 0 20px rgba(255, 0, 0, 0.15);
}


/* Séparateur du compteur de paires */

.digital-separator {
    color: #660000;

    margin: 0 2px;
}


/* ==============================
   GRILLE
   ============================== */

.memory-grid-wrapper {
    width: 100%;
    margin: 0;
}


/* ==============================
   MOBILE
   ============================== */

@media (max-width: 600px) {

    .memory-game-wrapper {
        width: 95%;
    }

    .memory-stats {
        padding: 12px 5px;
    }

    .digital-stat {
        padding: 5px;
    }

    .digital-label {
        font-size: 11px;
        letter-spacing: 1px;
    }

    .digital-display {
        min-width: 0;
        width: 100%;

        padding: 6px 4px;

        font-size: 28px;
        letter-spacing: 2px;
    }

}

/* ==============================
   NAVBAR
   ============================== */

.navbar {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    padding: 15px 30px;
    background: #222;
    color: #fff;
    box-sizing: border-box;
}


/* ==============================
   LOGO
   ============================== */

.navbar-left {
    grid-column: 1;
    grid-row: 1;
}

.navbar-brand {
    color: #fff;
    text-decoration: none;

    font-size: 1.6rem;
    font-weight: 700;
}


/* ==============================
   SCORES
   ============================== */

.navbar-right {
    grid-column: 2;
    grid-row: 1;
    display: flex;
    align-items: center;
}

.navbar-right a {
    color: #fff;
    text-decoration: none;
    margin: 0;
    padding: 8px 16px;
    border-radius: 8px;
    background: #333;
    transition: background 0.2s ease;
}

.navbar-right a:hover {
    background: #444;
    text-decoration: none;
}


/* ==============================
   THÈMES
   ============================== */

.navbar-center {
    grid-column: 1 / -1;
    grid-row: 2;
    margin-top: 15px;
    min-width: 0;
}

.navbar-themes {
    display: flex;
    align-items: center;
    gap: 10px;
    overflow-x: auto;
    padding-bottom: 5px;
}


/* Liens des thèmes */

.navbar-themes a {
    flex: 0 0 auto;
    color: #fff;
    text-decoration: none;
    margin: 0;
    padding: 8px 14px;
    border-radius: 8px;
    background: #2d2d2d;
    white-space: nowrap;
    transition:
        background-color 0.2s ease,
        transform 0.2s ease;
}

.navbar-themes a:hover {
    background: #444;
    transform: translateY(-1px);
    text-decoration: none;
}


/* ==============================
   SCROLLBAR DES THÈMES
   ============================== */

.navbar-themes::-webkit-scrollbar {
    height: 6px;
}

.navbar-themes::-webkit-scrollbar-thumb {
    background: #555;
    border-radius: 10px;
}

.navbar-themes::-webkit-scrollbar-track {
    background: transparent;
}


/* ==============================
   SPAN
   ============================== */

.navbar span {
    margin-right: 15px;
}
/* ==============================
 Accueil des thèmes
   ============================== */
.theme-card {
    text-decoration: none;
    color: inherit;
}

.theme-image-wrapper {
    height: 200px;              /* hauteur fixe */
    width: 100%;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: white;  
}

.theme-image {
    width: 100%;
    height: 100%;
    object-fit: contain;          /* recadre sans déformer */
    object-position: center; /* centre l'image */
}

.card-front-content {
    font-size: 80px;
    color: #b993d6;
    user-select: none; /* empêche la sélection du texte */
}


/* ==============================
Tableau des scores
   ============================== */

 

/* CONTENEUR */
.leaderboard-container {
    max-width: 900px;
    margin: 50px auto;
    padding: 20px;
    background: linear-gradient(180deg, #1b2838, #171a21);
    border-radius: 12px;
    box-shadow: 0 0 30px rgba(0,0,0,0.6);
}

/* TITRE */
.leaderboard-title {
    text-align: center;
    color: #66c0f4;
    margin-bottom: 25px;
    font-size: 32px;
    letter-spacing: 1px;
}

/* TABLE */
.leaderboard-table {
    width: 100%;
    border-collapse: collapse;
    color: #c7d5e0;
    font-size: 15px;
}

/* HEADER */
.leaderboard-table thead {
    background: #2a475e;
}

.leaderboard-table th {
    padding: 12px;
    text-align: left;
    text-transform: uppercase;
    font-size: 13px;
    color: #acdbf5;
}

/* LIGNES */
.leaderboard-table td {
    padding: 12px;
}

/* ALTERNANCE */
.leaderboard-table tbody tr:nth-child(even) {
    background: rgba(255,255,255,0.03);
}

/* HOVER */
.leaderboard-table tbody tr:hover {
    background: rgba(102,192,244,0.15);
    transform: scale(1.01);
    transition: all 0.15s ease;
}

/* COLONNES */
.rank {
    width: 60px;
    font-weight: bold;
}

.player {
    font-weight: bold;
    color: #ffffff;
}

.moves, .time {
    text-align: center;
    font-family: monospace;
}

.date {
    font-size: 13px;
    color: #8f98a0;
}

/* PODIUM */
.rank-1 {
    background: linear-gradient(90deg, #ffd70033, transparent);
    font-weight: bold;
}

.rank-2 {
    background: linear-gradient(90deg, #c0c0c033, transparent);
}

.rank-3 {
    background: linear-gradient(90deg, #cd7f3233, transparent);
}

/* EMPTY */
.empty {
    text-align: center;
    padding: 20px;
    color: #8f98a0;
    font-style: italic;
}

/* ==============================
   LEADERBOARD ACCUEIL
   ============================== */

.home-leaderboard {
    max-width: 850px;
    margin: 50px auto;
    padding: 30px;
    background-color: #ffffff;
    border-radius: 16px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.15);
}


/* En-tête */

.home-leaderboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
}

.home-leaderboard-header h2 {
    margin: 0;
}


/* Liste des scores */

.home-leaderboard-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}


/* Une ligne */

.home-score {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 15px 20px;
    background-color: #f8f9fa;
    border-radius: 10px;
    box-sizing: border-box;
}


/* Position */

.home-rank {
    width: 60px;
    flex-shrink: 0;
    text-align: center;
    font-size: 1.4rem;
}


/* Joueur */

.home-player {
    flex: 1;
    font-size: 1.2rem;
    font-weight: bold;
}


/* Informations */

.home-score-info {
    display: flex;
    align-items: center;
    gap: 20px;
    white-space: nowrap;
}


/* Footer */

.home-leaderboard-footer {
    margin-top: 25px;
    text-align: center;
}


/* Bouton */

.leaderboard-link {
    display: inline-block;
    padding: 12px 22px;
    background-color: #222;
    color: #fff;
    text-decoration: none;
    border-radius: 8px;
}

.leaderboard-link:hover {
    background-color: #444;
}


/* Lien classement */

.leaderboard-see-all {
    color: #333;
    text-decoration: none;
    font-weight: bold;
}

.leaderboard-see-all:hover {
    text-decoration: underline;
}


/* Aucun score */

.home-empty-score {
    padding: 20px;
    text-align: center;
}


/* Mobile */

@media (max-width: 768px) {

    .home-leaderboard {
        padding: 20px;
    }

    .home-leaderboard-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .home-score-info {
        gap: 10px;
        font-size: 0.9rem;
    }
}

