body {
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.nav-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    padding: 1rem 2rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.home-btn {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    transition: all 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.home-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
    text-decoration: none;
    color: white;
}

.game-title {
    color: white;
    margin: 0;
    font-size: 1.8rem;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.game-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    max-width: 900px;
    margin: 0 auto;
    padding: 2rem;
    width: 100%;
    box-sizing: border-box;
}

.status-bar {
    display: flex;
    justify-content: space-around;
    background: rgba(255, 255, 255, 0.9);
    padding: 1rem;
    border-radius: 1rem;
    margin-bottom: 2rem;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.stat-item {
    text-align: center;
}

.stat-label {
    display: block;
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 0.25rem;
}

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

.game-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
    margin-bottom: 2rem;
}

.game-board {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    background: rgba(255, 255, 255, 0.9);
    padding: 2rem;
    border-radius: 1rem;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    min-height: 400px;
}

.memory-card {
    aspect-ratio: 1;
    background: #fff;
    border: 3px solid #ddd;
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.2rem;
    font-weight: bold;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    user-select: none;
}

.memory-card:hover:not(.flipped):not(.matched) {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
    border-color: #667eea;
}

.memory-card.flipped {
    background: #e3f2fd;
    border-color: #2196f3;
    color: #1976d2;
}

.memory-card.matched {
    background: #e8f5e8;
    border-color: #4caf50;
    color: #2e7d32;
    cursor: default;
}

.memory-card.wrong {
    background: #ffebee;
    border-color: #f44336;
    color: #c62828;
    animation: shake 0.5s ease-in-out;
}

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

.memory-card .card-back {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 2rem;
    border-radius: 0.2rem;
    transition: opacity 0.3s ease;
}

.memory-card.flipped .card-back,
.memory-card.matched .card-back {
    opacity: 0;
    pointer-events: none;
}

.memory-card .card-front {
    opacity: 0;
    transition: opacity 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    width: 100%;
}

.memory-card.flipped .card-front,
.memory-card.matched .card-front {
    opacity: 1;
}

.start-screen, .game-over-screen {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: white;
    border-radius: 1rem;
    padding: 3rem 2rem;
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    z-index: 10;
}

.start-screen h3, .game-over-screen h3 {
    color: #333;
    font-size: 2rem;
    margin-bottom: 1rem;
}

.start-screen p {
    color: #666;
    font-size: 1.1rem;
    margin-bottom: 2rem;
    max-width: 500px;
}

.difficulty-selector, .game-mode-selector {
    margin-bottom: 1.5rem;
}

.difficulty-selector label, .game-mode-selector label {
    display: block;
    margin-bottom: 0.5rem;
    color: #333;
    font-weight: bold;
}

.difficulty-selector select, .game-mode-selector select {
    font-size: 1rem;
    padding: 0.5rem 1rem;
    border: 2px solid #ddd;
    border-radius: 0.5rem;
    background: white;
    width: 200px;
}

.start-btn, .play-again-btn {
    font-size: 1.3rem;
    padding: 1rem 2rem;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.start-btn:hover, .play-again-btn:hover {
    background: #5a67d8;
    transform: translateY(-2px);
}

.final-stats {
    background: #f8f9fa;
    padding: 2rem;
    border-radius: 0.5rem;
    margin-bottom: 2rem;
    border-left: 4px solid #667eea;
}

.final-stats h4 {
    margin: 0 0 1rem 0;
    color: #333;
}

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

.instructions {
    background: rgba(255, 255, 255, 0.9);
    padding: 1.5rem;
    border-radius: 1rem;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.instructions h4 {
    margin-top: 0;
    color: #333;
    font-size: 1.2rem;
}

.instructions p {
    margin: 0.5rem 0;
    color: #666;
    font-size: 0.95rem;
}

.hidden {
    display: none !important;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .nav-header {
        padding: 0.75rem 1rem;
    }
    
    .game-title {
        font-size: 1.4rem;
    }
    
    .game-container {
        padding: 1rem;
    }
    
    .status-bar {
        padding: 0.75rem;
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .stat-item {
        display: flex;
        justify-content: space-between;
        align-items: center;
    }
    
    .stat-label, .stat-value {
        display: inline;
    }
    
    .stat-value {
        font-size: 1.2rem;
    }
    
    .game-board {
        padding: 1rem;
        gap: 0.75rem;
    }
    
    .memory-card {
        font-size: 1rem;
    }
    
    .memory-card .card-back {
        font-size: 1.5rem;
    }
}

@media (max-width: 600px) {
    .game-board {
        grid-template-columns: repeat(4, 1fr);
        gap: 0.5rem;
        padding: 0.75rem;
    }
    
    .memory-card {
        font-size: 0.9rem;
    }
    
    .memory-card .card-back {
        font-size: 1.2rem;
    }
    
    .start-screen, .game-over-screen {
        padding: 2rem 1rem;
    }
}

@media (max-width: 480px) {
    .nav-header {
        padding: 0.5rem;
    }
    
    .game-title {
        font-size: 1.2rem;
    }
    
    .game-container {
        padding: 0.5rem;
    }
    
    .memory-card {
        font-size: 0.8rem;
    }
    
    .memory-card .card-back {
        font-size: 1rem;
    }
    
    .difficulty-selector select, .game-mode-selector select {
        width: 100%;
        max-width: 250px;
    }
}