/* Import modern font */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;600;700&display=swap');

/* CSS Variables for theming */
:root {
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --secondary-gradient: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    --success-gradient: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    --danger-gradient: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
    --card-back: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --card-front: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    --bg-color: #0f0c29;
    --bg-gradient: linear-gradient(135deg, #0f0c29 0%, #302b63 50%, #24243e 100%);
    --text-light: #ffffff;
    --text-dark: #2d3748;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    --shadow-hover: 0 15px 40px rgba(0, 0, 0, 0.4);
}

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

body {
    font-family: 'Poppins', sans-serif;
    background: var(--bg-gradient);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    color: var(--text-light);
}

.container {
    max-width: 1200px;
    width: 100%;
    animation: fadeIn 0.6s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

.game-header h1 {
    font-size: 3rem;
    font-weight: 700;
    background: var(--success-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 10px;
    text-shadow: 0 0 30px rgba(79, 172, 254, 0.5);
}

.subtitle {
    font-size: 1.2rem;
    color: rgba(255, 255, 255, 0.8);
    font-weight: 400;
}

/* Game Info Bar */
.game-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    gap: 20px;
    flex-wrap: wrap;
}

.score-container {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 15px 30px;
    box-shadow: var(--shadow);
    border: 1px solid rgba(255, 255, 255, 0.2);
    text-align: center;
}

.score-label {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 5px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.score-value {
    font-size: 2.5rem;
    font-weight: 700;
    background: var(--success-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.reset-btn {
    background: var(--primary-gradient);
    color: var(--text-light);
    border: none;
    padding: 15px 30px;
    border-radius: 15px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: 'Poppins', sans-serif;
}

.reset-btn:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-hover);
}

.reset-btn:active {
    transform: translateY(-1px);
}

.reset-btn svg {
    transition: transform 0.3s ease;
}

.reset-btn:hover svg {
    transform: rotate(180deg);
}

/* Game Status */
.game-status {
    text-align: center;
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 25px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.game-status.win {
    background: var(--success-gradient);
    color: var(--text-light);
    animation: pulse 0.6s ease-in-out;
}

.game-status.lose {
    background: var(--danger-gradient);
    color: var(--text-light);
    animation: shake 0.5s ease-in-out;
}

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

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

/* Game Board */
.game-board {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 15px;
    margin-bottom: 30px;
    perspective: 1000px;
}

/* Card Styles */
.card {
    aspect-ratio: 3/4;
    position: relative;
    cursor: pointer;
    transform-style: preserve-3d;
    transition: transform 0.6s cubic-bezier(0.4, 0.0, 0.2, 1);
}

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

.card.matched {
    animation: matchAnimation 0.6s ease-in-out;
    pointer-events: none;
}

@keyframes matchAnimation {
    0%, 100% { transform: rotateY(180deg) scale(1); }
    50% { transform: rotateY(180deg) scale(1.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: 3rem;
    font-weight: 700;
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
}

.card:hover .card-face {
    box-shadow: var(--shadow-hover);
}

.card-back {
    background: var(--card-back);
    color: var(--text-light);
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.card-back::before {
    content: '?';
    font-size: 4rem;
    opacity: 0.5;
}

.card-front {
    background: var(--card-front);
    color: var(--text-dark);
    transform: rotateY(180deg);
    border: 2px solid rgba(102, 126, 234, 0.3);
}

.card.disabled {
    pointer-events: none;
    opacity: 0.6;
}

/* Game Rules */
.game-rules {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 25px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.game-rules h3 {
    margin-bottom: 15px;
    font-size: 1.5rem;
    background: var(--secondary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.game-rules ul {
    list-style: none;
    padding: 0;
}

.game-rules li {
    padding: 8px 0;
    padding-left: 25px;
    position: relative;
    color: rgba(255, 255, 255, 0.9);
    line-height: 1.6;
}

.game-rules li::before {
    content: '✓';
    position: absolute;
    left: 0;
    color: #4facfe;
    font-weight: 700;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .game-board {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .game-header h1 {
        font-size: 2.5rem;
    }
}

@media (max-width: 768px) {
    .game-board {
        grid-template-columns: repeat(4, 1fr);
        gap: 10px;
    }
    
    .game-header h1 {
        font-size: 2rem;
    }
    
    .card-face {
        font-size: 2rem;
    }
    
    .card-back::before {
        font-size: 2.5rem;
    }
    
    .game-info {
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .game-board {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
    }
    
    .game-header h1 {
        font-size: 1.8rem;
    }
    
    .subtitle {
        font-size: 1rem;
    }
    
    .card-face {
        font-size: 1.5rem;
    }
    
    .score-value {
        font-size: 2rem;
    }
}
