:root {
    --primary-color: #6C63FF;
    --secondary-color: #FF6584;
    --accent-color: #43D9AD;
    --background-color: #2F2E41;
    --surface-color: #3F3D56;
    --text-color: #FFFFFF;
    --text-secondary: #B0B0B0;
    --success-color: #4CAF50;
    --card-back: #2F2E41;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Poppins', sans-serif;
    background: linear-gradient(135deg, #2F2E41 0%, #1F1D36 100%);
    color: var(--text-color);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

.main-container {
    width: 100%;
    max-width: 900px;
    background-color: rgba(63, 61, 86, 0.9);
    backdrop-filter: blur(15px);
    border-radius: 25px;
    padding: 30px;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.5),
        inset 0 1px 1px rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    flex-direction: column;
    align-items: center;
}

header {
    text-align: center;
    margin-bottom: 25px;
    width: 100%;
    border-bottom: 2px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 15px;
}

h1 {
    font-size: 2.5rem;
    color: var(--primary-color);
    text-shadow: 0 4px 10px rgba(108, 99, 255, 0.5);
    margin-bottom: 15px;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.stats-bar {
    display: flex;
    justify-content: center;
    gap: 30px;
    flex-wrap: wrap;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: rgba(0, 0, 0, 0.2);
    padding: 10px 25px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    min-width: 120px;
}

.stat-label {
    font-size: 0.9rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--accent-color);
}

.game-board {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 15px;
    margin: 20px 0;
    perspective: 1000px;
    width: 100%;
    max-width: 700px;
}

.card {
    aspect-ratio: 1;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.6s cubic-bezier(0.4, 0.0, 0.2, 1);
    cursor: pointer;
    border-radius: 12px;
}

.card:hover {
    transform: scale(1.05);
    z-index: 10;
}

.card.flipped {
    transform: rotateY(180deg);
}

.card.matched {
    transform: rotateY(180deg) scale(0.95);
    opacity: 0.8;
    cursor: default;
}

.card-face {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 12px;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    border: 2px solid rgba(255, 255, 255, 0.1);
}

.card-front {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    font-size: 2rem;
    color: rgba(255, 255, 255, 0.2);
}

.card-front::after {
    content: '?';
    font-weight: 800;
}

.card-back {
    background-color: white;
    transform: rotateY(180deg);
    padding: 5px;
}

.card-back img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 8px;
}

.controls {
    display: flex;
    gap: 20px;
    margin-top: 20px;
}

.action-button {
    background: linear-gradient(45deg, var(--primary-color), var(--secondary-color));
    border: none;
    padding: 15px 35px;
    color: white;
    font-size: 1.1rem;
    font-weight: bold;
    border-radius: 30px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
    box-shadow: 0 5px 15px rgba(108, 99, 255, 0.4);
}

.action-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(108, 99, 255, 0.6);
}

.action-button.secondary {
    background: transparent;
    border: 2px solid var(--accent-color);
    color: var(--accent-color);
    box-shadow: none;
}

.action-button.secondary:hover {
    background-color: rgba(67, 217, 173, 0.1);
    box-shadow: 0 0 15px rgba(67, 217, 173, 0.3);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(15, 14, 23, 0.95);
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(8px);
}

.modal-content {
    background: linear-gradient(135deg, var(--surface-color), #2F2E41);
    padding: 40px;
    border-radius: 25px;
    text-align: center;
    max-width: 450px;
    width: 90%;
    border: 3px solid var(--primary-color);
    box-shadow: 0 0 40px rgba(108, 99, 255, 0.5);
    animation: modalPop 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.modal h2 {
    color: var(--accent-color);
    margin-bottom: 15px;
    font-size: 2.2rem;
}

.modal p {
    font-size: 1.2rem;
    color: var(--text-secondary);
    margin-bottom: 25px;
}

.modal-stats {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-bottom: 30px;
}

.modal-stat {
    display: flex;
    flex-direction: column;
}

.modal-stat span {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.modal-stat strong {
    font-size: 1.5rem;
    color: var(--text-color);
}

.modal-buttons {
    display: flex;
    justify-content: center;
    gap: 15px;
}

@keyframes modalPop {
    from {
        transform: scale(0.8) translateY(20px);
        opacity: 0;
    }

    to {
        transform: scale(1) translateY(0);
        opacity: 1;
    }
}

@media (max-width: 600px) {
    .game-board {
        grid-template-columns: repeat(4, 1fr);
        gap: 10px;
    }

    h1 {
        font-size: 1.8rem;
    }

    .action-button {
        padding: 12px 25px;
        font-size: 1rem;
    }
}