:root {
    --primary-color: #2c3e50;
    --secondary-color: #3498db;
    --accent-color: #e74c3c;
    --text-color: #ecf0f1;
    --card-back: #34495e;
    --card-front: #2980b9;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: Arial, sans-serif;
    background-color: #1a1a1a;
    color: #ffffff;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

.game-container {
    width: 100%;
    max-width: 1000px;
    padding: 2rem;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.stats {
    display: flex;
    gap: 2rem;
    font-size: 1.2rem;
}

.controls {
    display: flex;
    gap: 1rem;
}

button, select {
    padding: 0.5rem 1rem;
    font-size: 1rem;
    border: none;
    border-radius: 5px;
    background: linear-gradient(45deg, #4a9eff, #9b4aff);
    color: white;
    cursor: pointer;
    transition: transform 0.2s;
}

button:hover, select:hover {
    transform: translateY(-2px);
}

.game-board {
    display: grid;
    gap: 10px;
    margin: 0 auto;
    perspective: 1000px;
}

.card {
    position: relative;
    width: 100%;
    padding-bottom: 100%;
    transform-style: preserve-3d;
    transition: transform 0.6s;
    cursor: pointer;
}

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

.card-front, .card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 2em;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.card-front {
    background: rgba(255, 255, 255, 0.1);
    transform: rotateY(180deg);
}

.card-back {
    background: linear-gradient(45deg, #4a9eff22, #9b4aff22);
}

.card.matched {
    animation: matchedAnimation 0.5s ease-in-out;
}

.card.matching {
    animation: matchingAnimation 0.5s ease-in-out;
}

@keyframes matchedAnimation {
    0%, 100% { transform: rotateY(180deg) scale(1); }
    50% { transform: rotateY(180deg) scale(1.1); }
}

@keyframes matchingAnimation {
    0%, 100% { box-shadow: 0 0 0 rgba(74, 158, 255, 0); }
    50% { box-shadow: 0 0 20px rgba(74, 158, 255, 0.8); }
}

.level-up {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    background: linear-gradient(45deg, #4a9eff, #9b4aff);
    padding: 2rem 4rem;
    border-radius: 10px;
    font-size: 2rem;
    font-weight: bold;
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 100;
}

.level-up.show {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
}

.game-over {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.9);
    padding: 2rem;
    border-radius: 10px;
    text-align: center;
    display: none;
    z-index: 100;
}

.game-over.show {
    display: block;
    animation: fadeIn 0.3s ease;
}

.final-stats {
    margin: 2rem 0;
    font-size: 1.2rem;
}

.final-stats p {
    margin: 0.5rem 0;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@media (max-width: 768px) {
    .game-container {
        padding: 1rem;
    }

    .game-header {
        flex-direction: column;
        align-items: stretch;
    }

    .stats {
        justify-content: space-between;
    }

    .controls {
        justify-content: stretch;
    }

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