:root {
    --primary-color: #77dd77;
    --secondary-color: #a8e6cf;
    --accent-color: #2ed9f7;
    --light-color: #e8f5e9;
    --success-color: #2e7d32;
    --error-color: #c8e6c9;
    --text-color: #1b5e20;
    --white: #ffffff;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: "Poppins", sans-serif;
}

/* Estilos del Header mejorado */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    padding: 0 10%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    border-bottom: 2px solid #fff;
    transition: all 0.3s ease;
}

.header:hover {
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
}

.logo {
    font-size: 28px;
    font-family: "Montserrat", sans-serif;
    font-weight: 700;
    color: var(--white);
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.2);
    letter-spacing: 1px;
}

.navigation ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.header .navigation ul li {
    float: left;
    position: relative;
}

.header .navigation ul li a {
    font-family: "Poppins", sans-serif;
    font-size: 16px;
    font-weight: 500;
    color: var(--white);
    text-decoration: none;
    padding: 22px 20px;
    display: block;
    transition: all 0.3s ease;
}

.header .navigation ul li a:hover {
    background-color: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
}

.header .navigation ul li ul {
    position: absolute;
    right: 0;
    width: 220px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 0 0 8px 8px;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
    display: none;
    overflow: hidden;
}

.header .navigation ul li ul li a {
    color: var(--text-color);
    padding: 12px 20px;
    font-size: 14px;
}

.header .navigation ul li ul li a:hover {
    background-color: var(--light-color);
    color: var(--primary-color);
}

.header .navigation ul li:hover > ul {
    display: initial;
    animation: fadeIn 0.3s ease-out;
}

#toggle,
.header label {
    display: none;
    cursor: pointer;
}

.menu {
    width: 28px;
    height: 28px;
    filter: brightness(0) invert(1);
}

@media (max-width: 950px) {
    .header label {
        display: initial;
    }

    .header {
        padding: 15px 10%;
    }

    .header .navigation {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: var(--primary-color);
        display: none;
        border-radius: 0 0 12px 12px;
    }

    .header .navigation ul li {
        width: 100%;
    }

    .header .navigation ul li a {
        padding: 12px 20px;
    }

    .header .navigation ul li ul {
        position: relative;
        width: 100%;
        left: 0;
        background: rgba(255, 255, 255, 0.1);
    }

    .header .navigation ul li ul li a {
        padding-left: 30px;
    }

    #toggle:checked ~ .navigation {
        display: block;
        animation: slideDown 0.4s ease-out;
    }
}

/* Estilos del cuerpo y fondo */
body {
    font-family: "Poppins", sans-serif;
    background: #c5ffc7;
    margin: 0;
    padding: 0;
    padding-top: 80px;
    min-height: 100vh;
    color: var(--text-color);
    background-size: 400% 400%;
    animation: gradientBG 15s ease infinite;
}

/* Animación de fondo */
@keyframes gradientBG {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

/* Animaciones */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Estilos del memorama */
.game-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
    text-align: center;
}

.game-title {
    font-family: "Poppins", sans-serif;
    color: var(--text-color);
    margin-bottom: 20px;
    font-size: 2.2rem;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.1);
}

.game-info {
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
    background: rgba(255, 255, 255, 0.7);
    padding: 15px;
    border-radius: 10px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.moves,
.timer {
    font-weight: 600;
    color: var(--primary-color);
}

.memory-game {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 15px;
    perspective: 1000px;
    margin-bottom: 30px;
}

.memory-card {
    width: 100%;
    height: 120px;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.5s;
    cursor: pointer;
    border-radius: 10px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.memory-card:active {
    transform: scale(0.97);
}

.memory-card.flip {
    transform: rotateY(180deg);
}

.front-face,
.back-face {
    width: 100%;
    height: 100%;
    position: absolute;
    backface-visibility: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    padding: 10px;
}

.front-face {
    background: var(--white);
    transform: rotateY(180deg);
    font-weight: 600;
    font-size: 1.2rem;
    color: var(--primary-color);
}

.back-face {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    font-size: 2rem;
}

.back-face img {
    width: 80%;
    height: 80%;
    object-fit: contain;
}

.reset-btn {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border: none;
    padding: 12px 25px;
    font-size: 1rem;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    font-weight: 600;
    margin-top: 20px;
}

.reset-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3);
}

.congrats-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.5s;
}

.congrats-content {
    background: white;
    padding: 30px;
    border-radius: 15px;
    text-align: center;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
    position: relative;
}

.congrats-content h2 {
    color: var(--success-color);
    font-size: 2rem;
    margin-bottom: 15px;
}

.congrats-content p {
    margin-bottom: 20px;
    font-size: 1.1rem;
}

.close-modal {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 50px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s;
}

.close-modal:hover {
    background: var(--secondary-color);
    transform: translateY(-2px);
}

/* Responsive styles */
@media (max-width: 768px) {
    .memory-game {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .game-title {
        font-size: 1.8rem;
    }
}

@media (max-width: 576px) {
    .memory-game {
        grid-template-columns: repeat(3, 1fr);
    }

    .memory-card {
        height: 100px;
    }

    .front-face {
        font-size: 1rem;
    }

    .back-face {
        font-size: 1.5rem;
    }
    
    .game-title {
        font-size: 1.5rem;
    }
    
    .game-info {
        flex-direction: column;
        gap: 10px;
        align-items: center;
    }
}

@media (max-width: 400px) {
    .memory-game {
        grid-template-columns: repeat(3, 1fr);
        gap: 10px;
    }
    
    .memory-card {
        height: 90px;
    }
}