/* ===================== */
/* GLOBAL */
/* ===================== */

body {
    margin: 0;
    padding: 0;
    background: linear-gradient(-45deg, #0a0a0a, #1a1a1a, #0a0a0a, #1a1a1a);
    background-size: 400% 400%;
    font-family: Arial, sans-serif;
    color: white;
    text-align: center;
    animation: gradientBG 15s ease infinite;
}

@keyframes gradientBG {
    0% {background-position: 0% 50%;}
    50% {background-position: 100% 50%;}
    100% {background-position: 0% 50%;}
}

/* ===================== */
/* NAVBAR */
/* ===================== */

nav {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 15px 40px;
    position: fixed;
    top: 0;
    left: 0;
    background: linear-gradient(90deg, #1a1a1a, #111);
    box-shadow: 0 4px 20px rgba(0,0,0,0.7);
    z-index: 100;
}

.logo-nav {
    height: 50px;
    border-radius: 50%;
    border: 2px solid red;
    margin-right: auto;
}

nav ul {
    list-style: none;
    display: flex;
    gap: 40px;
}

nav ul li a {
    color: white;
    text-decoration: none;
    font-weight: bold;
}

nav ul li a:hover {
    color: red;
    text-shadow: 0 0 10px red;
}

/* ===================== */
/* CONTAINER */
/* ===================== */

.container {
    margin-top: 140px;
    padding: 20px;
}

h1 {
    color: #ff2e2e;
    text-shadow: 0 0 10px red;
}

/* ===================== */
/* MODE BUTTONS */
/* ===================== */



/* ===================== */
/* MODE SELECTION */
/* ===================== */

.mode-selection {
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
    margin-top: 30px;
}

/* ===================== */
/* BUTTON BASE */
/* ===================== */

.mode-btn {
    position: relative;
    overflow: hidden;

    padding: 15px 35px;
    border-radius: 15px;
    border: none;

    cursor: pointer;
    color: white;

    background: linear-gradient(135deg, #111, #1a1a1a);

    box-shadow: 0 0 15px rgba(255,0,0,0.4);
    transition: all 0.4s ease;

    font-size: 16px;
    letter-spacing: 1px;

    z-index: 1;
}

/* TEXTE + ICONE ALIGNEMENT */
.mode-btn span {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;

    position: relative;
    z-index: 2;
}

/* ICÔNES */
.mode-btn i {
    font-size: 18px;
    transition: 0.3s ease;
}

/* ===================== */
/* EFFET LUMIÈRE */
/* ===================== */

.mode-btn::before {
    content: "";
    position: absolute;

    top: 0;
    left: -100%;

    width: 100%;
    height: 100%;

    background: linear-gradient(
        120deg,
        transparent,
        rgba(255, 0, 0, 0.5),
        transparent
    );

    transition: 0.6s;
}

/* ===================== */
/* HOVER */
/* ===================== */

.mode-btn:hover::before {
    left: 100%;
}

.mode-btn:hover {
    transform: scale(1.1);
    box-shadow: 
        0 0 25px red,
        0 0 50px rgba(255,0,0,0.5);
}

/* animation icône */
.mode-btn:hover i {
    transform: rotate(-5deg) scale(1.1);
}

/* ===================== */
/* CLICK */
/* ===================== */

.mode-btn:active {
    transform: scale(0.95);
}

/* ===================== */
/* SOLO STYLE */
/* ===================== */

.solo {
    border: 2px solid rgb(121, 42, 56);
}

.solo i {
    color:rgb(121, 42, 56);
}

.solo:hover {
    box-shadow: 
        0 0 25px rgb(121, 42, 56),
        0 0 50px rgba(121, 42, 57, 0.527);
}

/* ===================== */
/* MULTI STYLE */
/* ===================== */

.multi {
    border: 1px solid rgb(225, 82, 122);
}

.multi i {
    color: rgb(225, 82, 122);
}

.multi:hover {
    box-shadow: 
        0 0 25px rgb(225, 82, 122),
        0 0 50px rgba(225, 82, 122, 0.553);
}

.solo:hover {
    transform: scale(1.03) rotate(-0.5deg);
}
.multi:hover {
    transform: scale(1.03) rotate(0.5deg);
}

/* ===================== */
/* INPUT */
/* ===================== */

.players-input input {
    padding: 12px;
    margin: 10px;
    border-radius: 10px;
    border: 2px solid red;
    background: #111;
    color: white;
    font-size: 16px;
}

/* ===================== */
/* BUTTON */
/* ===================== */

.download-btn {
    padding: 12px 35px;
    background: linear-gradient(45deg, red, #ff4d4d);
    border: none;
    border-radius: 12px;
    color: white;
    cursor: pointer;
    box-shadow: 0 0 15px red;
    transition: 0.3s;
}

.download-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 0 35px red;
}

/* ===================== */
/* STATS */
/* ===================== */

.stats {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin: 20px;
    flex-wrap: wrap;
}

.stat-box {
    padding: 10px 20px;
    border-radius: 10px;
    background: #111;
    box-shadow: 0 0 10px red;
}

/* PLAYER COLORS */

.player1-active {
    border: 2px solid cyan;
}

.player2-active {
    border: 2px solid yellow;
}

/* ===================== */
/* GAME GRID */
/* ===================== */

#game {
    display: grid;
    grid-template-columns: repeat(5, 90px);
    gap: 12px;
    justify-content: center;
    margin-top: 20px;
}

/* ===================== */
/* CARD */
/* ===================== */

.card {
    width: 90px;
    height: 90px;
    perspective: 1000px;
    cursor: pointer; /* HAND CURSOR */
}

.inner {
    width: 100%;
    height: 100%;
    transition: transform 0.6s;
    transform-style: preserve-3d;
    border-radius: 15px;
}

.card.flip .inner {
    transform: rotateY(180deg);
}

.front, .back {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 15px;
    backface-visibility: hidden;
}

.front {
    transform: rotateY(180deg);
}

.card img {
    width: 100%;
    height: 100%;
    border-radius: 15px;
}

/* HOVER */

/* ✅ hover seulement sur cartes jouables */
.card:not(.flip):not(.matched):hover .inner {
    transform: scale(1.05);
    box-shadow: 0 0 20px red;
}
/* ❌ pas de hover sur carte déjà retournée */
.card.flip:hover .inner {
    transform: rotateY(180deg); /* garde le flip */
}
/* ❌ aucune interaction sur cartes validées */
/* MATCH SANS CHANGER LA TAILLE */
.card.matched {
    border-radius: 15px;
    box-shadow: 
        inset 0 0 0 3px lime,   /* bordure interne */
        0 0 20px lime;          /* glow */
    cursor: default;
}

.card.matched:hover .inner {
    transform: rotateY(180deg); /* reste affichée */
}
/* 🔒 empêche tout bug de hover */
.card {
    overflow: hidden;
}

/* MATCH */

.card.matched {
    border: 3px solid lime;
    border-radius: 15px; /* 🔥 IMPORTANT */
    box-shadow: 0 0 25px lime;
}
.inner,
.front,
.back,
.card img {
    border-radius: 15px;
}
/* ===================== */
/* SOCIAL BAR */
/* ===================== */

.social-bar {
    width: 100%;
    background: #111;
    padding: 15px;
    position: fixed;
    bottom: 0;
    left: 0;
    display: flex;
    justify-content: center;
    gap: 30px;
    box-shadow: 0 -2px 15px rgba(0,0,0,0.6);
}

.social-bar a {
    color: red;
    font-size: 26px;
    transition: 0.3s;
}

.social-bar a:hover {
    color: #ff4d4d;
    transform: scale(1.2);
}

/* ===================== */
/* COPYRIGHT */
/* ===================== */

.copyright {
    margin-top: 80px;
    padding: 20px;
    background: #111;
}

/* ===================== */
/* RESPONSIVE */
/* ===================== */

@media (max-width: 768px) {

    #game {
        grid-template-columns: repeat(4, 70px);
    }

    .card {
        width: 70px;
        height: 70px;
    }

    nav ul {
        gap: 15px;
    }

    nav ul li a {
        font-size: 14px;
    }
}
/* WIN SCREEN */
.win-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 999;
    animation: fadeIn 0.5s ease;
}

.hidden {
    display: none;
}

.win-box {
    background: #111;
    padding: 40px;
    border-radius: 20px;
    box-shadow: 0 0 40px red;
    animation: pop 0.5s ease;
}

.win-box h2 {
    color: gold;
    font-size: 40px;
}

.win-box button {
    margin-top: 20px;
    padding: 10px 25px;
    background: red;
    border: none;
    border-radius: 10px;
    color: white;
    cursor: pointer;
}

@keyframes fadeIn {
    from {opacity: 0;}
    to {opacity: 1;}
}

@keyframes pop {
    from {transform: scale(0.5);}
    to {transform: scale(1);}
}
.instructions-box {
    width: fit-content;
    margin: 15px auto; /* centre sans casser le grid */
    padding: 12px 20px;

    background: #111;
    border-left: 4px solid red;
    border-radius: 10px;

    box-shadow: 0 0 15px rgba(255,0,0,0.4);
    font-size: 14px;
    text-align: center;

    opacity: 1;
    transition: opacity 0.8s ease;
}

/* disparition */
.instructions-box.hide {
    opacity: 0;
}
.instructions-box {
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from {opacity: 0; transform: translateY(-10px);}
    to {opacity: 1; transform: translateY(0);}
}
.social-bar {
    width: 100%;
    background-color: #111;
    padding: 15px 0;
    position: fixed;
    bottom: 0;
    left: 0;
    display: flex;
    justify-content: center;
    gap: 40px;
    box-shadow: 0 -2px 15px rgba(0,0,0,0.6);
}

.social-bar a {
    color: #ff0000;
    font-size: 28px;
    transition: all 0.4s ease;
}

.social-bar a:hover {
    color: #ff4d4d;
    transform: rotate(-15deg) scale(1.3);
    text-shadow: 0 0 15px #ff4d4d, 0 0 30px red;
}

.copyright {
    width: 100%;
    text-align: center;
    color: #ccc;
    font-size: 14px;
    margin-top: 10px;
    line-height: 1.6;
    margin-bottom: 75px;
}

.copyright span {
    display: block;
}

.copyright a {
    color: #d89797;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s ease;
}

.copyright a:hover {
    text-shadow: 0 0 10px red;
    color: #ff1a1a;
}
.ai-box {
    margin: 25px auto;
    padding: 15px 25px;

    max-width: 700px;

    background: #111;
    border-left: 4px solid red;
    border-radius: 10px;

    color: #ccc;
    font-size: 15px;
    line-height: 1.6;

    box-shadow: 0 0 15px rgba(255,0,0,0.3);
}

.ai-box:hover {
    transform: scale(1.02);
    box-shadow: 0 0 25px red;
}

.heart {
    color: rgb(228, 190, 190);
    font-size: 18px;
    margin-left: 5px;
}
.heart {
    animation: beat 2s infinite;
}

@keyframes beat {
    0% { transform: scale(1);   color: rgb(228, 190, 190); }
    50% { transform: scale(1.2);   color: rgb(223, 100, 100); }
    100% { transform: scale(1);   color: rgb(241, 12, 12); }
}
