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

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

/* Header Styles */
.header {
    text-align: center;
    color: white;
    margin-bottom: 30px;
}

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

/* Game Controls */
.game-controls {
    background: rgba(255,255,255,0.1);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 30px;
    display: flex;
    gap: 20px;
    align-items: center;
    flex-wrap: wrap;
    justify-content: center;
}

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

.difficulty-btn {
    padding: 8px 16px;
    border: none;
    border-radius: 8px;
    background: rgba(255,255,255,0.2);
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
}

.difficulty-btn:hover {
    background: rgba(255,255,255,0.3);
    transform: translateY(-2px);
}

.difficulty-btn.active {
    background: #4CAF50;
    box-shadow: 0 4px 15px rgba(76, 175, 80, 0.3);
}

/* Game Stats */
.game-stats {
    display: flex;
    gap: 20px;
    color: white;
    font-size: 1.1rem;
}

.stat {
    text-align: center;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: bold;
    display: block;
}

/* Reset Button */
.reset-btn {
    padding: 10px 20px;
    background: #ff6b6b;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.reset-btn:hover {
    background: #ff5252;
    transform: translateY(-2px);
}

/* Game Container */
.game-container {
    display: grid;
    gap: 15px;
    perspective: 1000px;
    margin-bottom: 20px;
}

.game-container.easy {
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(3, 1fr);
}

.game-container.medium {
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(4, 1fr);
}

.game-container.hard {
    grid-template-columns: repeat(6, 1fr);
    grid-template-rows: repeat(4, 1fr);
}

/* Card Styles */
.card {
    width: 100px;
    height: 100px;
    position: relative;
    cursor: pointer;
    transform-style: preserve-3d;
    transition: transform 0.6s ease;
}

.card:hover {
    transform: scale(1.05);
}

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

.card.matched {
    animation: matchPulse 0.6s ease;
    pointer-events: none;
}

/* Card Animations */
@keyframes matchPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

.card-face {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: bold;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.card-front {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    transform: rotateY(180deg);
}

.card-back {
    background: linear-gradient(135deg, #ffeaa7, #fab1a0);
    color: #2d3436;
}

.card-back::before {
    content: '?';
    font-size: 2.5rem;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

/* Victory Modal */
.victory-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.victory-modal.show {
    opacity: 1;
    visibility: visible;
}

.victory-content {
    background: white;
    border-radius: 20px;
    padding: 40px;
    text-align: center;
    transform: scale(0.7);
    transition: transform 0.3s ease;
}

.victory-modal.show .victory-content {
    transform: scale(1);
}

.victory-title {
    font-size: 2.5rem;
    color: #4CAF50;
    margin-bottom: 20px;
}

.victory-stats {
    font-size: 1.2rem;
    color: #666;
    margin-bottom: 30px;
}

.play-again-btn {
    padding: 15px 30px;
    background: #4CAF50;
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 1.1rem;
    cursor: pointer;
    transition: background 0.3s ease;
}

.play-again-btn:hover {
    background: #45a049;
}

/* Responsive Design */
@media (max-width: 768px) {
    .game-container {
        gap: 10px;
    }
    
    .card {
        width: 70px;
        height: 70px;
    }
    
    .card-face {
        font-size: 1.5rem;
    }
    
    h1 {
        font-size: 2rem;
    }
    
    .game-controls {
        flex-direction: column;
        gap: 15px;
    }
}