@import url('https://fonts.googleapis.com/css2?family=Fredoka+One:wght@400&family=Fredoka:wght@300;400;500&display=swap');

* {
    box-sizing: border-box;
}

html {
    height: 100%;
    width: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden;
    background-color: #0d2117;
}

body {
    margin: 0;
    padding: 0;
    font-family: 'Fredoka', cursive;
    height: 100%;
    width: 100%;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    background: linear-gradient(to bottom, #0f2b20, #225141);
}

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

.cloud {
    position: absolute;
    background: white;
    border-radius: 50px;
    opacity: 0.8;
    animation: float linear infinite;
}

.cloud:before {
    content: '';
    position: absolute;
    background: white;
    border-radius: 50px;
}

@keyframes float {
    0% {
        transform: translateX(-100px);
    }

    100% {
        transform: translateX(calc(100vw + 100px));
    }
}

.container {
    height: 100%;
    width: 100%;
    max-width: 500px;
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    margin: 0;
    overflow: hidden;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.4);
    border: none;
    border-radius: 0;
}

@media (min-width: 500px) {
    .container {
        height: 90%;
        top: 5%;
        border-radius: 20px;
        border: 4px solid #3e2723;
    }
}

canvas {
    height: 100%;
    width: 100%;
    display: block;
    background: transparent;
}

#scoreBoard {
    width: 100%;
    height: 60px;
    background: linear-gradient(45deg, #FF6A00, #EE0979);
    position: absolute;
    top: 0;
    left: 0;
    z-index: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: transform 0.3s;
    border-bottom: 3px solid #C00860;
}

#scoreBoard.pulse {
    animation: pulse 0.5s;
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }

    100% {
        transform: scale(1);
    }
}

#scoreBoard p {
    font-size: 24px;
    padding: 0;
    line-height: 47px;
    margin: 0;
    color: #FFFFFF;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    font-weight: 500;
}

#scoreBoard:before {
    content: '🍌 ';
    font-size: 20px;
}

#scoreBoard:after {
    content: ' 🍌';
    font-size: 20px;
}

#preloader {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #1f4037, #99f2c8);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 10;
    transition: opacity 0.5s;
}

.loader {
    width: 80px;
    height: 80px;
    border: 8px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top: 8px solid #FFD700;
    animation: spin 1.5s linear infinite;
    margin-bottom: 20px;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

#preloader p {
    color: white;
    font-size: 18px;
    margin-top: 10px;
    font-weight: 400;
}

#mainMenu,
#gameOverMenu {
    height: 100%;
    width: 100%;
    text-align: center;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 2;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: linear-gradient(135deg, rgba(31, 64, 55, 0.95), rgba(153, 242, 200, 0.95));
    transition: opacity 0.5s, transform 0.5s;
}

#gameOverMenu {
    visibility: hidden;
    opacity: 0;
    transform: translateY(20px);
    background: linear-gradient(135deg, rgba(238, 9, 121, 0.95), rgba(255, 106, 0, 0.95));
}

#gameOverMenu.visible {
    visibility: visible;
    opacity: 1;
    transform: translateY(0);
}

h2,
h3,
h1 {
    font-weight: normal;
    margin: 10px 0;
    font-family: 'Fredoka One', cursive;
}

h1 {
    font-size: 40px;
    color: #fff;
    margin: 0px;
    text-shadow: 3px 3px 0 #228B22, 6px 6px 0 rgba(0, 0, 0, 0.3);
    transform: translateY(-20px);
    animation: titleBounce 1s forwards;
}

h1:before {
    content: '🐵 ';
    font-size: 40px;
}

h1:after {
    content: ' 🐵';
    font-size: 40px;
}

@keyframes titleBounce {
    0% {
        transform: translateY(-20px);
        opacity: 0;
    }

    60% {
        transform: translateY(10px);
        opacity: 1;
    }

    100% {
        transform: translateY(0);
        opacity: 1;
    }
}

h3 {
    font-size: 16px;
    text-align: center;
    margin: 5px 0;
    color: #fff;
    opacity: 0;
    animation: fadeIn 0.5s 0.5s forwards;
    font-family: 'Fredoka', cursive;
    font-weight: 400;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.button {
    width: 160px;
    height: 50px;
    background: linear-gradient(to bottom, #FFD700, #FFA500);
    display: flex;
    justify-content: center;
    align-items: center;
    color: #8B4513;
    font-size: 18px;
    font-weight: 500;
    text-decoration: none;
    margin: 15px 0;
    border-radius: 25px;
    box-shadow: 0 6px 0 #FF8C00, 0 8px 12px rgba(0, 0, 0, 0.3);
    transition: all 0.2s;
    opacity: 0;
    animation: fadeIn 0.5s 1s forwards;
    position: relative;
    overflow: hidden;
    font-family: 'Fredoka One', cursive;
}

.button:before {
    content: '🍌 ';
    font-size: 16px;
}

.button:after {
    content: ' 🍌';
    font-size: 16px;
}

.button:hover {
    transform: translateY(-3px);
    box-shadow: 0 9px 0 #FF8C00, 0 12px 15px rgba(0, 0, 0, 0.4);
    background: linear-gradient(to bottom, #FFDF00, #FFB500);
}

.button:active {
    transform: translateY(2px);
    box-shadow: 0 3px 0 #FF8C00, 0 5px 8px rgba(0, 0, 0, 0.3);
}

.info {
    position: absolute;

    bottom: 20px;
    margin: 0;
    color: white;
    background: rgba(139, 69, 19, 0.8);
    padding: 15px;
    border-radius: 15px;
    opacity: 0;
    animation: fadeIn 0.5s 1.5s forwards;
    margin-left: 20px;
    font-family: 'Fredoka', cursive;
    font-weight: 400;
}

.key {
    width: 35px;
    height: 35px;
    background: linear-gradient(to bottom, #FFD700, #FFA500);
    text-indent: -9999px;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    margin: 0 5px;
    border-radius: 8px;
    box-shadow: 0 3px 0 #FF8C00;
    color: #8B4513;
    font-weight: bold;
    position: relative;
    top: -2px;
    font-family: 'Fredoka One', cursive;
}

.key:before {
    content: '';
    position: absolute;
    text-indent: 0;
    font-size: 16px;
}

.key.left:before {
    content: '←';
}

.key.right:before {
    content: '→';
}

.key.space:before {
    content: '⎵';
    font-size: 12px;
}

.particle {
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
    z-index: 3;
}

.vine {
    position: absolute;
    width: 20px;
    height: 100%;
    background: repeating-linear-gradient(to bottom,
            #1b5e20 0px,
            #1b5e20 10px,
            #2e7d32 10px,
            #2e7d32 20px);
    border-radius: 10px;
    opacity: 0.6;
}

.vine.left {
    left: 10px;
    animation: sway 3s ease-in-out infinite;
}

.vine.right {
    right: 10px;
    animation: sway 3s ease-in-out infinite reverse;
}

@keyframes sway {

    0%,
    100% {
        transform: rotate(0deg);
    }

    50% {
        transform: rotate(2deg);
    }
}

.mobile-controls {
    display: none;
    position: absolute;
    bottom: 20px;
    left: 0;
    width: 100%;
    justify-content: space-between;
    padding: 0 40px;
    pointer-events: none;
    z-index: 5;
}

.mobile-btn {
    width: 70px;
    height: 70px;
    border-radius: 15px;
    background: linear-gradient(to bottom, #FFD700, #FFA500);
    border: none;
    color: #8B4513;
    font-size: 35px;
    font-weight: bold;
    display: flex;
    justify-content: center;
    align-items: center;
    pointer-events: auto;
    user-select: none;
    -webkit-user-select: none;
    touch-action: manipulation;
    box-shadow: 0 6px 0 #FF8C00, 0 8px 12px rgba(0, 0, 0, 0.3);
    outline: none;
    font-family: 'Fredoka One', cursive;
    transition: transform 0.1s, box-shadow 0.1s;
}

.mobile-btn:active {
    background: linear-gradient(to bottom, #FFDF00, #FFB500);
    transform: translateY(4px);
    box-shadow: 0 2px 0 #FF8C00, 0 4px 6px rgba(0, 0, 0, 0.3);
}

@media (max-width: 450px) {
    h1 {
        font-size: 32px;
    }
}

@media (max-width: 500px) {
    .mobile-controls.active {
        display: flex;
    }

    .info {
        display: none;
    }
}
