/* === MEMORY GAME STYLES === */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    background-attachment: fixed;
    min-height: 100vh;
    color: #333;
    overflow-x: hidden;
}

/* Animated background particles */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><circle cx="20" cy="20" r="2" fill="rgba(255,255,255,0.1)"><animate attributeName="opacity" values="0;1;0" dur="3s" repeatCount="indefinite"/></circle><circle cx="80" cy="40" r="1.5" fill="rgba(255,255,255,0.15)"><animate attributeName="opacity" values="0;1;0" dur="2s" repeatCount="indefinite" begin="1s"/></circle><circle cx="40" cy="80" r="1" fill="rgba(255,255,255,0.2)"><animate attributeName="opacity" values="0;1;0" dur="4s" repeatCount="indefinite" begin="2s"/></circle></svg>');
    pointer-events: none;
    z-index: -1;
}

.game-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* === HEADER === */
.game-header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 20px;
}

.back-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #6366f1;
    text-decoration: none;
    font-weight: 500;
    padding: 10px 16px;
    border-radius: 10px;
    transition: all 0.3s ease;
}

.back-btn:hover {
    background: rgba(99, 102, 241, 0.1);
    transform: translateX(-5px);
}

.game-header h1 {
    font-size: 2rem;
    font-weight: 700;
    color: #1f2937;
    display: flex;
    align-items: center;
    gap: 12px;
}

.game-header h1 i {
    color: #f59e0b;
}

.game-stats {
    display: flex;
    gap: 20px;
}

.stat {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(99, 102, 241, 0.1);
    padding: 10px 16px;
    border-radius: 10px;
    font-weight: 600;
    color: #374151;
}

.stat i {
    color: #6366f1;
}

/* === MAIN CONTENT === */
.game-main {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 20px;
}

.game-controls {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(99, 102, 241, 0.3);
}

.btn-secondary {
    background: linear-gradient(135deg, #64748b, #475569);
    color: white;
}

.btn-secondary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(100, 116, 139, 0.3);
}

.difficulty-select,
.theme-select {
    padding: 12px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    background: white;
    cursor: pointer;
    transition: all 0.3s ease;
}

.difficulty-select:focus,
.theme-select:focus {
    outline: none;
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

/* === MEMORY BOARD === */
.memory-board-container {
    position: relative;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    min-height: 500px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.memory-board {
    display: grid;
    gap: 15px;
    perspective: 1000px;
}

.memory-board.easy {
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(3, 1fr);
}

.memory-board.medium {
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(4, 1fr);
}

.memory-board.hard {
    grid-template-columns: repeat(6, 1fr);
    grid-template-rows: repeat(4, 1fr);
}

.memory-board.expert {
    grid-template-columns: repeat(6, 1fr);
    grid-template-rows: repeat(6, 1fr);
}

/* === MEMORY CARDS === */
.memory-card {
    aspect-ratio: 1;
    position: relative;
    cursor: pointer;
    transform-style: preserve-3d;
    transition: transform 0.6s ease;
    min-width: 60px;
    min-height: 60px;
}

.memory-card.flipped {
    transform: rotateY(180deg);
}

.memory-card.matched {
    animation: matchAnimation 0.5s ease-in-out;
}

.memory-card.shake {
    animation: shakeAnimation 0.5s ease-in-out;
}

.card-face {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: bold;
    backface-visibility: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.card-back {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: white;
    border: 3px solid #4f46e5;
    position: relative;
    overflow: hidden;
}

.card-back::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent, rgba(255,255,255,0.1), transparent);
    animation: shimmer 3s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%) translateY(-100%) rotate(45deg); }
    100% { transform: translateX(100%) translateY(100%) rotate(45deg); }
}

.card-front {
    background: linear-gradient(135deg, #f8fafc, #e2e8f0);
    color: #1f2937;
    border: 3px solid #cbd5e1;
    transform: rotateY(180deg);
}

.memory-card:not(.flipped):not(.matched):hover {
    transform: scale(1.05);
    box-shadow: 0 6px 25px rgba(0, 0, 0, 0.15);
    cursor: pointer;
}

.memory-card.flipped,
.memory-card.matched {
    cursor: default;
}

/* === GAME OVERLAY === */
.game-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 20px;
    backdrop-filter: blur(5px);
}

.game-overlay.hidden {
    display: none;
}

.overlay-content {
    text-align: center;
    color: white;
    padding: 40px;
    max-width: 400px;
}

.overlay-content h2 {
    font-size: 2.5rem;
    margin-bottom: 15px;
    color: #f59e0b;
}

.overlay-content p {
    font-size: 1.2rem;
    margin-bottom: 30px;
    opacity: 0.9;
}

.overlay-stats {
    margin: 30px 0;
    padding: 20px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    backdrop-filter: blur(10px);
}

.stat-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    font-size: 1.1rem;
}

.stat-label {
    opacity: 0.8;
}

.stat-value {
    font-weight: 600;
    color: #f59e0b;
}

/* === GAME INFO SIDEBAR === */
.game-info {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 25px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    height: fit-content;
}

.info-section {
    margin-bottom: 30px;
}

.info-section:last-child {
    margin-bottom: 0;
}

.info-section h3 {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
    color: #1f2937;
    font-size: 1.2rem;
}

.info-section h3 i {
    color: #6366f1;
}

.info-section ul {
    list-style: none;
    padding: 0;
}

.info-section li {
    padding: 8px 0;
    padding-left: 20px;
    position: relative;
    color: #4b5563;
}

.info-section li::before {
    content: '•';
    color: #6366f1;
    font-weight: bold;
    position: absolute;
    left: 0;
}

.rating-system,
.leaderboard {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.rating-item,
.leaderboard-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    background: rgba(99, 102, 241, 0.05);
    border-radius: 8px;
    border-left: 3px solid #6366f1;
}

.rating-stars {
    font-size: 1.2rem;
}

.rating-desc {
    font-weight: 500;
    color: #374151;
}

/* === ANIMATIONS === */
@keyframes matchAnimation {
    0%, 100% { transform: rotateY(180deg) scale(1); }
    50% { transform: rotateY(180deg) scale(1.1); }
}

@keyframes shakeAnimation {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.btn:active {
    transform: scale(0.95);
}

.game-complete .overlay-content {
    animation: pulse 1s ease-in-out;
}

/* === RESPONSIVE DESIGN === */
@media (max-width: 1024px) {
    .game-main {
        grid-template-columns: 1fr;
    }
    
    .game-info {
        order: -1;
    }
}

@media (max-width: 768px) {
    .game-container {
        padding: 10px;
    }
    
    .header-content {
        flex-direction: column;
        text-align: center;
    }
    
    .game-stats {
        justify-content: center;
    }
    
    .game-controls {
        justify-content: center;
        flex-direction: column;
        gap: 10px;
    }
    
    .game-header h1 {
        font-size: 1.5rem;
    }
    
    .memory-board {
        gap: 10px;
    }
    
    .card-face {
        font-size: 1.5rem;
    }
    
    .info-section {
        margin-bottom: 20px;
    }
}

@media (max-width: 480px) {
    .memory-board {
        gap: 8px;
    }
    
    .card-face {
        font-size: 1.2rem;
    }
    
    .memory-board.expert {
        grid-template-columns: repeat(4, 1fr);
        grid-template-rows: repeat(9, 1fr);
    }
    
    .memory-board.hard {
        grid-template-columns: repeat(4, 1fr);
        grid-template-rows: repeat(6, 1fr);
    }
}

/* === THEME VARIATIONS === */
.card-front.theme-animals { font-size: 1.8rem; }
.card-front.theme-shapes { font-size: 2.2rem; }
.card-front.theme-numbers { font-size: 2rem; font-weight: 700; }
.card-front.theme-emoji { font-size: 2rem; }