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

body {
    font-family: 'Nunito', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.container {
    max-width: 900px;
    width: 100%;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    position: relative;
}

header {
    background: linear-gradient(90deg, #4b6cb7 0%, #182848 100%);
    color: white;
    padding: 25px;
    text-align: center;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 15px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.game-info {
    display: flex;
    justify-content: space-around;
    flex-wrap: wrap;
}

.info-item {
    background: rgba(255, 255, 255, 0.2);
    padding: 10px 20px;
    border-radius: 50px;
    margin: 5px;
    font-weight: 700;
    font-size: 1.1rem;
}

.label {
    margin-right: 5px;
    opacity: 0.9;
}

.game-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    flex-wrap: wrap;
    gap: 15px;
    background: #f8f9fa;
}

.difficulty-select {
    display: flex;
    align-items: center;
    gap: 10px;
}

.difficulty-select label {
    font-weight: 700;
    color: #333;
}

.difficulty-select select {
    padding: 8px 15px;
    border-radius: 8px;
    border: 2px solid #4b6cb7;
    background: white;
    font-weight: 600;
    color: #333;
    cursor: pointer;
}

button {
    padding: 12px 25px;
    border: none;
    border-radius: 8px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1rem;
}

#start-btn {
    background: linear-gradient(90deg, #4CAF50, #45a049);
    color: white;
    box-shadow: 0 4px 15px rgba(76, 175, 80, 0.3);
}

#start-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(76, 175, 80, 0.4);
}

#reset-btn, #play-again-btn {
    background: linear-gradient(90deg, #f44336, #d32f2f);
    color: white;
    box-shadow: 0 4px 15px rgba(244, 67, 54, 0.3);
}

#reset-btn:hover, #play-again-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(244, 67, 54, 0.4);
}

#play-again-btn {
    padding: 15px 30px;
    font-size: 1.1rem;
    margin-top: 20px;
}

.game-board {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    padding: 30px;
    min-height: 400px;
    justify-items: center;
}

.card {
    width: 100%;
    height: 100px;
    perspective: 1000px;
    cursor: pointer;
}

.card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 0.6s;
    transform-style: preserve-3d;
}

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

.card.matched .card-inner {
    transform: rotateY(180deg);
}

.card-front, .card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 12px;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.card-front {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    transform: rotateY(180deg);
    font-size: 2.5rem;
    color: white;
}

.card-back {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    font-size: 2rem;
    color: white;
}

.win-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
}

.win-content {
    background: white;
    padding: 40px;
    border-radius: 20px;
    text-align: center;
    max-width: 90%;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    animation: popIn 0.5s ease-out;
}

.win-content h2 {
    color: #4b6cb7;
    margin-bottom: 20px;
    font-size: 2.5rem;
}

.win-content p {
    font-size: 1.3rem;
    margin: 10px 0;
    color: #333;
}

.hidden {
    display: none;
}

@keyframes popIn {
    0% {
        transform: scale(0.5);
        opacity: 0;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

@media (max-width: 768px) {
    .container {
        border-radius: 15px;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    .game-info {
        flex-direction: column;
        align-items: center;
    }
    
    .game-board {
        grid-template-columns: repeat(3, 1fr);
        padding: 20px;
        gap: 10px;
    }
    
    .card {
        height: 80px;
    }
    
    .card-front, .card-back {
        font-size: 1.8rem;
    }
}

@media (max-width: 480px) {
    .game-board {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .card {
        height: 70px;
    }
    
    .card-front, .card-back {
        font-size: 1.5rem;
    }
    
    .game-controls {
        flex-direction: column;
    }
}