* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #e0c3fc 0%, #8ec5fc 50%, #b8e6f0 100%);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px;
    position: relative;
    overflow-x: hidden;
}

/* Weather Canvas */
#weatherCanvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.container {
    max-width: 1400px;
    width: 100%;
    margin-bottom: 60px;
    position: relative;
    z-index: 2;
}

/* Header */
.game-header {
    text-align: center;
    margin-bottom: 30px;
    color: #2d3748;
}

.game-title {
    font-size: 3.5em;
    margin-bottom: 10px;
    text-shadow: 3px 3px 6px rgba(255, 255, 255, 0.5);
    animation: float 3s ease-in-out infinite;
    font-weight: 800;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.game-subtitle {
    font-size: 1.3em;
    color: #4a5568;
    font-style: italic;
    font-weight: 500;
}

@keyframes float {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-15px);
    }
}

/* Level Selection */
.level-selection {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(20px);
    border-radius: 25px;
    padding: 40px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
    animation: slideIn 0.5s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.level-title {
    text-align: center;
    font-size: 2.5em;
    color: #2d3748;
    margin-bottom: 30px;
    font-weight: 700;
}

.level-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.level-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    padding: 25px 20px;
    border-radius: 15px;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.3);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.level-btn:hover {
    transform: translateY(-5px) scale(1.05);
    box-shadow: 0 12px 30px rgba(102, 126, 234, 0.4);
    animation: shake 0.5s ease;
}

@keyframes shake {
    0%, 100% { transform: translateX(0) translateY(-5px); }
    25% { transform: translateX(-5px) translateY(-5px); }
    75% { transform: translateX(5px) translateY(-5px); }
}

.level-number {
    font-size: 1.4em;
    font-weight: 700;
}

.level-info {
    font-size: 0.95em;
    opacity: 0.95;
}

/* Game Info */
.game-info {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.info-item {
    background: rgba(255, 255, 255, 0.85);
    padding: 15px 25px;
    border-radius: 15px;
    backdrop-filter: blur(20px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.info-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 25px rgba(0, 0, 0, 0.15);
}

.info-label {
    color: #4a5568;
    font-size: 0.95em;
    margin-right: 8px;
    font-weight: 600;
}

.info-value {
    color: #2d3748;
    font-weight: 800;
    font-size: 1.3em;
}

/* Audio Controls */
.audio-controls {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 20px;
}

.audio-btn {
    background: rgba(255, 255, 255, 0.85);
    border: 2px solid rgba(102, 126, 234, 0.3);
    padding: 12px 24px;
    border-radius: 12px;
    color: #2d3748;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    backdrop-filter: blur(20px);
    transition: all 0.3s ease;
}

.audio-btn:hover {
    background: rgba(255, 255, 255, 0.95);
    border-color: #667eea;
    transform: translateY(-2px);
}

.audio-btn.muted {
    opacity: 0.5;
    background: rgba(200, 200, 200, 0.6);
}

/* Game Board */
.game-board {
    display: grid;
    gap: 12px;
    margin-bottom: 30px;
    padding: 25px;
    background: rgba(255, 255, 255, 0.75);
    border-radius: 25px;
    backdrop-filter: blur(20px);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
    max-width: 100%;
    margin-left: auto;
    margin-right: auto;
    min-height: 400px;
    justify-content: center;
    align-content: center;
}

.game-board.level-1,
.game-board.level-2 {
    grid-template-columns: repeat(4, minmax(80px, 110px));
    max-width: 550px;
}

.game-board.level-3,
.game-board.level-4 {
    grid-template-columns: repeat(5, minmax(80px, 100px));
    max-width: 650px;
}

.game-board.level-5,
.game-board.level-6,
.game-board.level-7 {
    grid-template-columns: repeat(6, minmax(70px, 95px));
    max-width: 750px;
}

.card {
    aspect-ratio: 1;
    background: white;
    border-radius: 12px;
    cursor: pointer;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.3s ease;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
    width: 100%;
    height: auto;
    will-change: transform;
}

.card:hover:not(.matched):not(.flipped) {
    transform: scale(1.05);
    box-shadow: 0 6px 15px rgba(102, 126, 234, 0.3);
}

.card.flipped {
    transform: rotateY(180deg);
    pointer-events: none;
}

.card.matched {
    opacity: 0.6;
    cursor: default;
    pointer-events: none;
    animation: matchPulse 0.5s ease;
}

@keyframes matchPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.card.matched:hover {
    transform: none;
}

.card-front,
.card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.card-front {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 10px;
}

.card-back-img {
    width: 65%;
    height: 65%;
    object-fit: contain;
    filter: drop-shadow(2px 2px 4px rgba(0, 0, 0, 0.2));
}

.card-back {
    background: white;
    transform: rotateY(180deg);
    padding: 8px;
}

.card-back img {
    width: 75%;
    height: 75%;
    object-fit: contain;
}

.card-back.emoji {
    font-size: 2.5em;
    display: flex;
    align-items: center;
    justify-content: center;
}

@media (max-width: 1200px) {
    .card {
        max-width: 100px;
        max-height: 100px;
    }
    
    .card-back.emoji {
        font-size: 2.2em;
    }
    
    .card-back-img {
        width: 60%;
        height: 60%;
    }
}

/* Control Buttons */
.game-controls {
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
}

.control-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 15px 40px;
    border-radius: 15px;
    font-size: 1.1em;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.3);
}

.control-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 30px rgba(102, 126, 234, 0.4);
}

.control-btn:active {
    transform: translateY(0);
}

.control-btn.secondary {
    background: rgba(255, 255, 255, 0.85);
    color: #667eea;
    border: 2px solid #667eea;
}

.control-btn.secondary:hover {
    background: white;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(10px);
}

.modal.show {
    display: flex;
}

.modal-content {
    background: white;
    padding: 50px;
    border-radius: 30px;
    text-align: center;
    max-width: 500px;
    box-shadow: 0 25px 70px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.5s ease;
}

@keyframes modalSlideIn {
    from {
        transform: translateY(-100px) scale(0.8);
        opacity: 0;
    }
    to {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

.modal-content h2 {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 20px;
    font-size: 2.5em;
    font-weight: 800;
}

.modal-content p {
    color: #4a5568;
    margin-bottom: 30px;
    font-size: 1.2em;
    line-height: 1.8;
    font-weight: 500;
}

.modal-buttons {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* Footer */
.game-footer {
    width: 100%;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(20px);
    padding: 25px;
    margin-top: auto;
    position: relative;
    z-index: 2;
    box-shadow: 0 -5px 20px rgba(0, 0, 0, 0.1);
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    text-align: center;
}

.footer-text {
    color: #2d3748;
    margin-bottom: 15px;
    font-size: 1em;
    font-weight: 500;
}

.footer-link {
    color: #667eea;
    text-decoration: none;
    transition: all 0.3s ease;
    font-weight: 700;
}

.footer-link:hover {
    color: #764ba2;
    text-decoration: underline;
}

.footer-socials {
    display: flex;
    justify-content: center;
    gap: 20px;
}

.social-link {
    color: #667eea;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: rgba(102, 126, 234, 0.1);
    transition: all 0.3s ease;
}

.social-link:hover {
    background: rgba(102, 126, 234, 0.2);
    transform: translateY(-5px) rotate(5deg);
    color: #764ba2;
}

/* Responsive Design */
@media (max-width: 768px) {
    .game-title {
        font-size: 2.5em;
    }

    .level-buttons {
        grid-template-columns: repeat(2, 1fr);
    }

    .game-board {
        gap: 10px;
        padding: 20px;
        min-height: 350px;
    }
    
    .game-board.level-1,
    .game-board.level-2 {
        grid-template-columns: repeat(4, minmax(65px, 85px));
    }
    
    .game-board.level-3,
    .game-board.level-4 {
        grid-template-columns: repeat(5, minmax(60px, 75px));
    }

    .game-board.level-5,
    .game-board.level-6,
    .game-board.level-7 {
        grid-template-columns: repeat(6, minmax(55px, 70px));
    }
    
    .card {
        border-radius: 10px;
    }
    
    .card-front,
    .card-back {
        border-radius: 10px;
    }
    
    .card-back.emoji {
        font-size: 1.8em;
    }
    
    .card-back-img {
        width: 55%;
        height: 55%;
    }

    .control-btn {
        padding: 12px 25px;
        font-size: 1em;
    }

    .modal-content {
        padding: 30px;
        margin: 20px;
    }
    
    .info-item {
        padding: 10px 15px;
    }
    
    .info-label {
        font-size: 0.85em;
    }
    
    .info-value {
        font-size: 1.1em;
    }
}

@media (max-width: 480px) {
    .game-title {
        font-size: 2em;
    }
    
    .game-subtitle {
        font-size: 1em;
    }

    .level-buttons {
        grid-template-columns: 1fr;
    }
    
    .game-board {
        gap: 8px;
        padding: 15px;
        min-height: 300px;
    }
    
    .game-board.level-1,
    .game-board.level-2 {
        grid-template-columns: repeat(4, minmax(55px, 70px));
    }

    .game-board.level-3,
    .game-board.level-4 {
        grid-template-columns: repeat(5, minmax(50px, 62px));
    }
    
    .game-board.level-5,
    .game-board.level-6,
    .game-board.level-7 {
        grid-template-columns: repeat(6, minmax(45px, 55px));
    }
    
    .card {
        border-radius: 8px;
    }
    
    .card-front,
    .card-back {
        border-radius: 8px;
        padding: 5px;
    }

    .card-back.emoji {
        font-size: 1.5em;
    }
    
    .card-back-img {
        width: 50%;
        height: 50%;
    }
    
    .game-info {
        gap: 10px;
    }
    
    .info-item {
        padding: 8px 12px;
    }
    
    .info-label {
        font-size: 0.75em;
    }
    
    .info-value {
        font-size: 1em;
    }
    
    .audio-controls {
        gap: 10px;
    }
    
    .audio-btn {
        padding: 8px 16px;
        font-size: 0.9em;
    }
}