* {
    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;
    justify-content: center;
    align-items: center;
    padding: 20px;
    padding-bottom: 80px;
}

.container {
    text-align: center;
    max-width: 900px;
    width: 100%;
}

h1 {
    color: white;
    margin-bottom: 10px;
    font-size: 2em;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.game-subtitle {
    color: rgba(255, 255, 255, 0.9);
    font-size: 1.1em;
    margin-bottom: 25px;
    font-weight: 500;
    letter-spacing: 0.5px;
}

/* Level Selection */
.level-selection {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
}

.level-selection h2 {
    color: white;
    font-size: 1.8em;
    margin-bottom: 30px;
}

.level-buttons {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin-bottom: 20px;
}

.level-btn {
    background: white;
    border: none;
    border-radius: 15px;
    padding: 25px 20px;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 140px;
    justify-content: center;
}

.level-btn:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.3);
    background: linear-gradient(135deg, #fff 0%, #f8f9ff 100%);
}

.level-title {
    font-size: 1.8em;
    font-weight: bold;
    color: #667eea;
    display: block;
}

.level-desc {
    font-size: 1em;
    color: #666;
    display: block;
    margin-top: 5px;
}

.high-score {
    display: block;
    font-size: 0.85em;
    color: #f5576c;
    margin-top: 8px;
    font-weight: 600;
    padding-top: 8px;
    border-top: 2px solid #f0f0f0;
}

.clear-btn {
    margin-top: 20px;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 2px solid white;
    padding: 12px 30px;
    font-size: 1em;
    font-weight: bold;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s;
}

.clear-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

/* Game Screen */
.stats {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 30px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.stats p {
    color: white;
    font-size: 1.2em;
    font-weight: bold;
}

.sound-btn {
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid white;
    color: white;
    font-size: 1.2em;
    padding: 8px 15px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s;
}

.sound-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.game-board {
    display: grid;
    gap: 15px;
    margin: 0 auto 30px;
    max-width: 800px;
}

/* Different grid layouts */
.game-board.easy {
    grid-template-columns: repeat(4, 1fr);
}

.game-board.medium {
    grid-template-columns: repeat(4, 1fr);
}

.game-board.hard {
    grid-template-columns: repeat(4, 1fr);
}

.game-board.expert {
    grid-template-columns: repeat(5, 1fr);
}

.card {
    aspect-ratio: 1;
    background: white;
    border-radius: 10px;
    cursor: pointer;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.3s;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.card:hover {
    transform: scale(1.05);
}

.card.flipped {
    transform: rotateY(180deg);
}

.card.flipped:hover {
    transform: rotateY(180deg) scale(1);
}

.card.matched {
    opacity: 0.6;
    cursor: default;
}

.card-front, .card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 10px;
}

.card-front {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
    font-size: 3em;
}

.card-back {
    background: white;
    transform: rotateY(180deg);
}

.card-back img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 10px;
}

/* Game Buttons */
.game-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

.game-btn {
    background: white;
    color: #667eea;
    border: none;
    padding: 15px 40px;
    font-size: 1.1em;
    font-weight: bold;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.game-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.3);
}

.game-btn.secondary {
    background: rgba(255, 255, 255, 0.9);
}

/* Footer - Fixed at bottom */
.footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
    padding: 15px 20px;
    text-align: center;
    color: white;
    font-size: 0.9em;
    z-index: 100;
}

.footer p {
    margin: 3px 0;
}

.footer a {
    color: #f093fb;
    text-decoration: none;
    font-weight: bold;
    transition: all 0.3s;
}

.footer a:hover {
    color: #f5576c;
    text-decoration: underline;
}

.footer .version {
    font-size: 0.85em;
    color: rgba(255, 255, 255, 0.7);
}

/* Welcome Modal */
.modal {
    display: flex;
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.3s ease;
}

.modal.hidden {
    display: none !important;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.modal-content {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 40px;
    border-radius: 20px;
    text-align: center;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    animation: slideUp 0.4s ease;
    border: 3px solid rgba(255, 255, 255, 0.3);
}

@keyframes slideUp {
    from {
        transform: translateY(50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-content h2 {
    color: white;
    font-size: 2.2em;
    margin-bottom: 20px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.modal-text {
    color: white;
    font-size: 1.3em;
    margin: 15px 0;
    line-height: 1.6;
}

.modal-subtext {
    color: rgba(255, 255, 255, 0.9);
    font-size: 1.1em;
    margin-top: 20px;
    margin-bottom: 25px;
}

.modal-btn {
    background: white;
    color: #667eea;
    border: none;
    padding: 18px 50px;
    font-size: 1.3em;
    font-weight: bold;
    border-radius: 30px;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
    margin-top: 10px;
}

.modal-btn:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
    background: linear-gradient(135deg, #fff 0%, #f8f9ff 100%);
}

.modal-btn:active {
    transform: translateY(-1px);
}

/* Responsive for mobile */
@media (max-width: 600px) {
    h1 {
        font-size: 1.3em;
    }
    
    .game-subtitle {
        font-size: 0.95em;
        margin-bottom: 20px;
    }
    
    .level-selection {
        padding: 25px 15px;
    }
    
    .level-buttons {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .level-btn {
        min-height: 120px;
        padding: 20px 15px;
    }
    
    .level-title {
        font-size: 1.5em;
    }
    
    .level-desc {
        font-size: 0.9em;
    }
    
    .game-board {
        gap: 10px;
    }
    
    .stats {
        gap: 15px;
        font-size: 0.9em;
    }
    
    .footer {
        font-size: 0.8em;
        padding: 12px 15px;
    }
}
