* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}
body {
    font-family: Arial, Helvetica, sans-serif;
    background-color: #2c3e50;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: #ecf0f1;
}
h1 {
    margin-bottom: 15px;
}
.game-info {
    margin-bottom: 20px;
    text-align: center;
}
.game-info p {
    margin: 5px 0;
}
.memory-game {
    display: grid;
    grid-template-columns: repeat(4, 100px);
    gap: 15px;
}
.card {
    width: 100px;
    height: 100px;
    perspective: 1000px;
    cursor: pointer;
}
.card-inner {
    width: 100%;
    height: 100%;
    position: relative;
    transition: transform 0.6s;
    transform-style: preserve-3d;
}
.card.flip .card-inner {
    transform: rotateY(180deg);
}
.card-front,
.card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 2rem;
}
.card-front {
    background-color: #ecf0f1;
    color: #2c3e50;
    transform: rotateY(180deg);
}
.card-back {
    background-color: #3498db;
}
.game-over {
    position: fixed;
    inset: 0;
    background: rgba(44, 62, 80, 0.9);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    z-index: 999;
}
.game-over p {
    margin: 10px 0;
    font-size: 1.5rem;
}
.game-over button {
    margin-top: 15px;
    padding: 10px 20px;
    font-size: 1rem;
    border: none;
    border-radius: 6px;
    background-color: #e74c3c;
    color: #fff;
    cursor: pointer;
}
#restart-btn {
    margin-bottom: 20px;
    padding: 10px 20px;
    font-size: 16px;
    border: none;
    border-radius: 6px;
    background-color: #e67e22;
    color: #fff;
    cursor: pointer;
    transition: background 0.3s;
}

#restart-btn:hover {
    background-color: #d35400;
}

.restart-modal {
    position: fixed;
    inset: 0;
    background: rgba(44, 62, 80, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.restart-box {
    background: #2c3e50;
    padding: 30px 40px;
    border-radius: 10px;
    text-align: center;
    color: #ecf0f1;
    animation: scaleIn 0.3s ease;
}

.restart-box p {
    font-size: 1.4rem;
    margin-bottom: 20px;
}

.restart-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
}

.restart-actions button {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    cursor: pointer;
}

#confirm-restart {
    background-color: #e74c3c;
    color: white;
}

#cancel-restart {
    background-color: #3498db;
    color: white;
}

.card-back {
    background-color: #5dade2; 
    background-image: repeating-linear-gradient(
        45deg,
        #aed6f1,
        #aed6f1 10px,
        #ebf5fb 10px,
        #ebf5fb 20px
    );
}


@keyframes scaleIn {
    from {
        transform: scale(0.8);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}


@media (max-width: 500px) {
    .memory-game {
        grid-template-columns: repeat(4, 80px);
        gap: 8px;
    }

    .card {
        width: 80px;
        height: 80px;
    }

    .card-front,
    .card-back {
        font-size: 1.5rem;
    }
}
