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

body {
    font-family: 'Fredoka', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 25%, #f093fb 50%, #f5576c 75%, #ffc857 100%);
    background-size: 400% 400%;
    animation: gradientShift 15s ease infinite;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.floating-shapes {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: -1;
}

.shape {
    position: absolute;
    opacity: 0.1;
    animation: float 20s infinite ease-in-out;
}

.shape-1 {
    width: 100px;
    height: 100px;
    background: radial-gradient(circle, #ff6b6b, transparent);
    border-radius: 50%;
    top: 10%;
    left: 10%;
    animation-delay: 0s;
}

.shape-2 {
    width: 150px;
    height: 150px;
    background: radial-gradient(circle, #4ecdc4, transparent);
    border-radius: 50%;
    top: 70%;
    right: 10%;
    animation-delay: 2s;
}

.shape-3 {
    width: 80px;
    height: 80px;
    background: radial-gradient(circle, #45b7d1, transparent);
    border-radius: 50%;
    top: 30%;
    right: 20%;
    animation-delay: 4s;
}

.shape-4 {
    width: 120px;
    height: 120px;
    background: radial-gradient(circle, #96ceb4, transparent);
    border-radius: 50%;
    bottom: 20%;
    left: 15%;
    animation-delay: 6s;
}

.shape-5 {
    width: 90px;
    height: 90px;
    background: radial-gradient(circle, #feca57, transparent);
    border-radius: 50%;
    top: 50%;
    left: 50%;
    animation-delay: 8s;
}

.shape-6 {
    width: 110px;
    height: 110px;
    background: radial-gradient(circle, #ff9ff3, transparent);
    border-radius: 50%;
    top: 80%;
    left: 40%;
    animation-delay: 10s;
}

.shape-7 {
    width: 70px;
    height: 70px;
    background: radial-gradient(circle, #74b9ff, transparent);
    border-radius: 50%;
    top: 20%;
    left: 70%;
    animation-delay: 12s;
}

@keyframes float {
    0%, 100% {
        transform: translateY(0px) rotate(0deg);
        opacity: 0.1;
    }
    25% {
        transform: translateY(-20px) rotate(90deg);
        opacity: 0.2;
    }
    50% {
        transform: translateY(0px) rotate(180deg);
        opacity: 0.1;
    }
    75% {
        transform: translateY(20px) rotate(270deg);
        opacity: 0.2;
    }
}

.main-container {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 25px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 1400px;
    width: 100%;
    padding: 30px;
    backdrop-filter: blur(10px);
    animation: float 6s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
}

.header {
    text-align: center;
    margin-bottom: 30px;
    background: linear-gradient(45deg, #ff6b6b, #4ecdc4, #45b7d1, #96ceb4);
    background-size: 300% 300%;
    animation: gradientMove 8s ease infinite;
    padding: 25px;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

@keyframes gradientMove {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.game-title {
    font-size: 3em;
    font-weight: 700;
    color: white;
    text-shadow: 3px 3px 6px rgba(0, 0, 0, 0.3);
    margin-bottom: 20px;
    letter-spacing: 2px;
    animation: pulse 2s ease-in-out infinite;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
}

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

.score-board {
    display: flex;
    justify-content: center;
    gap: 30px;
    flex-wrap: wrap;
}

.score, .timer, .moves {
    background: rgba(255, 255, 255, 0.9);
    padding: 12px 20px;
    border-radius: 15px;
    font-size: 1.1em;
    font-weight: 600;
    color: #333;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.score:hover, .timer:hover, .moves:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

.score i, .timer i, .moves i {
    color: #ff6b6b;
    margin-right: 8px;
}

.game-controls {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.btn {
    padding: 15px 30px;
    font-size: 1.1em;
    font-weight: 600;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
    position: relative;
    overflow: hidden;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn:before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    transition: left 0.5s;
}

.btn:hover:before {
    left: 100%;
}

.btn:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 12px 25px rgba(0, 0, 0, 0.3);
}

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

.btn-primary {
    background: linear-gradient(45deg, #4ecdc4, #44a3a0);
    color: white;
}

.btn-secondary {
    background: linear-gradient(45deg, #ff6b6b, #ee5a6f);
    color: white;
}

.btn-music {
    background: linear-gradient(45deg, #96ceb4, #88b0a3);
    color: white;
}

.btn-home {
    background: linear-gradient(45deg, #ff9ff3, #ee5a6f);
    color: white;
}

.game-area {
    margin-bottom: 30px;
}

.memory-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 20px;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.memory-card {
    position: relative;
    width: 100%;
    height: 200px;
    cursor: pointer;
    transform-style: preserve-3d;
    transition: transform 0.6s;
    perspective: 1000px;
}

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

.memory-card.matched {
    animation: matchAnimation 0.8s ease;
    pointer-events: none;
}

.memory-card.shake {
    animation: shake 0.5s ease;
}

.card-face {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 15px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.card-front {
    background: linear-gradient(135deg, #667eea, #764ba2);
    border: 3px solid rgba(255, 255, 255, 0.3);
}

.card-front::before {
    content: '🧠';
    font-size: 3em;
    color: white;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.card-back {
    background: white;
    transform: rotateY(180deg);
    padding: 10px;
}

.card-back img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 10px;
}

.card-back .card-word {
    font-size: 1.1em;
    font-weight: 600;
    color: #2d3436;
    text-align: center;
    word-wrap: break-word;
    padding: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
}

@keyframes matchAnimation {
    0% { transform: rotateY(180deg) scale(1); }
    50% { transform: rotateY(180deg) scale(1.2) rotate(5deg); }
    100% { transform: rotateY(180deg) scale(1); }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-10px); }
    20%, 40%, 60%, 80% { transform: translateX(10px); }
}

.feedback-area {
    text-align: center;
    margin-top: 30px;
}

.feedback-message {
    background: linear-gradient(45deg, #ff7979, #ff6348, #ff4757, #ee5a6f);
    background-size: 300% 300%;
    animation: gradientMove 6s ease infinite;
    color: white;
    padding: 20px 30px;
    border-radius: 20px;
    font-size: 1.4em;
    font-weight: 600;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    display: inline-block;
    animation: slideInUp 0.5s ease;
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.confetti {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: hidden;
    z-index: 9999;
}

.confetti-piece {
    position: absolute;
    width: 10px;
    height: 10px;
    background: linear-gradient(45deg, #ff6b6b, #4ecdc4, #45b7d1, #96ceb4);
    animation: confettiFall 3s ease-in-out;
}

@keyframes confettiFall {
    0% {
        transform: translateY(-100vh) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(100vh) rotate(720deg);
        opacity: 0;
    }
}

/* Game Footer */
.game-footer {
    background: rgba(255, 255, 255, 0.9);
    border-radius: 15px;
    padding: 20px;
    margin-top: 30px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(5px);
    animation: slideInUp 0.6s ease;
}

.game-footer .creator-credit {
    text-align: center;
    margin: 0;
    padding: 0;
    border: none;
}

.game-footer .made-by {
    font-size: 0.8em;
    color: #666;
    margin-bottom: 3px;
    font-weight: 500;
}

.game-footer .creator-name {
    color: #ff6b6b;
    font-weight: 700;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.game-footer .creator-name:hover {
    color: #4ecdc4;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.game-footer .visit-site {
    font-size: 0.7em;
    color: #888;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    transition: all 0.3s ease;
}

.game-footer .visit-site:hover {
    color: #ff6b6b;
}

.game-footer .creator-link {
    color: #ff6b6b;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
    border-bottom: 1px solid transparent;
}

.game-footer .creator-link:hover {
    color: #4ecdc4;
    border-bottom-color: #4ecdc4;
}

.game-footer .visit-site i {
    color: #feca57;
    font-size: 0.8em;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .memory-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 15px;
        padding: 15px;
    }

    .memory-card {
        height: 180px;
    }
}

@media (max-width: 768px) {
    .main-container {
        padding: 20px;
    }

    .game-title {
        font-size: 2em;
        flex-direction: column;
        gap: 10px;
    }

    .score-board {
        flex-direction: column;
        gap: 15px;
        align-items: center;
    }

    .memory-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 12px;
        padding: 12px;
    }

    .memory-card {
        height: 160px;
    }

    .game-controls {
        flex-direction: column;
        align-items: center;
    }

    .btn {
        width: 200px;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .main-container {
        padding: 15px;
    }

    .game-title {
        font-size: 1.5em;
    }

    .feedback-message {
        font-size: 1.1em;
        padding: 15px 20px;
    }

    .memory-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
        padding: 10px;
    }

    .memory-card {
        height: 140px;
    }

    .card-back .card-word {
        font-size: 0.9em;
    }
}

.fade-in {
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}