@property --xBig {
    syntax: '<length>';
    inherits: false;
    initial-value: 800px;
}

@property --xSmall {
    syntax: '<length>';
    inherits: false;
    initial-value: 600px;
}

@property --tree {
    syntax: '<length>';
    inherits: false;
    initial-value: 5000px;
}

:root {
    --birdColor: hsl(66, 100%, 54%);
    --pipes: linear-gradient(to right, hsl(157, 65%, 49%) 0% 20%, hsl(157, 65%, 57%) 20% 100%);
    --lips: hsl(3, 85%, 64%);
    --birdShadow: 5px 0 0 rgba(73, 42, 42, 0.2) inset;
    --background: linear-gradient(to right, hsl(204, 65%, 95%), hsl(203, 65%, 90%));
    --border: hsl(0, 0%, 19%);
    --shadow: 0 0 0 3px var(--border) inset;
    --trees: hsl(165, 100%, 33%);
    --bigMountainColor: hsl(2, 20%, 37%);
    --smallMountainColor: hsl(3, 9%, 46%);
    --sunColor: hsl(60, 100%, 50%);
    --width: 800px;
}

*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Peach Days';
}

body, html {
    width: 100%;
    height: 100%;
}

.screen {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    background-color: white;
    opacity: 0;
    display: none;
    animation: appear 50ms linear forwards alternate;
}

.container {
    width: 100%;
    height: 100%;
    background: var(--background);
    position: relative;
    overflow: hidden;
}

.container::before {
    position: absolute;
    content: "";
    width: 100%;
    height: 100%;
    background-image: 
        /*Footer*/
        conic-gradient(
            hsl(169, 28%, 81%)0deg 135deg,
            var(--trees) 135deg 225deg,
            hsl(169, 28%, 81%) 225deg 360deg
        ),
        /*Big Mountain*/
        conic-gradient(
            transparent 0deg 135deg,
            var(--bigMountainColor) 135deg 225deg,
            transparent 225deg 360deg
        ),
        /*Small Mountain*/
        conic-gradient(
            transparent 0deg 135deg,
            var(--smallMountainColor) 135deg 225deg,
            transparent 225deg 360deg
        ),
        /*Sun*/
        radial-gradient(
            circle,
            var(--sunColor) 0% 55%, 
            transparent 50% 100%
        );
    background-size: 50px 50px, var(--width) 800px, 600px 600px, 300px 300px;
    background-position: var(--tree) 100%, var(--xBig) 100%, var(--xSmall) 100%, 50% 30%;
    filter: blur(3px);
    background-repeat: repeat-x, repeat-x, repeat-x, no-repeat;
    animation: move 60s linear infinite;
}

@keyframes move {
    100%{
        --xBig: 0px;
        --xSmall: 0px;
        --tree: 0px;
    }
}

.container .bird {
    --width: 60px;
    width: var(--width);
    aspect-ratio: 1/1;
    border-radius: 30px;
    background: var(--birdColor);
    position: absolute;
    border: 3px solid var(--border);
    z-index: 2;
    top: calc(50% - (var(--width) / 2));
    left: calc(50% - (var(--width) / 2));
    box-shadow: var(--birdShadow);
    transform-origin: center;
    /* transition: .2s ease; */
}

.container .bird .wing {
    position: absolute;
    width: 75%;
    height: 30px;
    top: calc(50% - 10px);
    left: -14px;
    background-color: var(--birdColor);
    border: 3px solid black;
    border-radius: 30px;
    box-shadow: var(--birdShadow);
    transform-origin: right center;
    animation: flap .1s linear infinite alternate;
}

.container .bird::before {
    position: absolute;
    content: "";
    width: 51%;
    height: 16px;
    background: var(--lips);
    border: 3px solid var(--border);
    top: calc(50% - 9px);
    border-radius: 30px;
    left: calc(50% + 12px);
}

.container .bird::after {
    position: absolute;
    content: "";
    width: 14px;
    height: 14px;
    background: 
        radial-gradient(
            circle, 
            white 0 50%,
            transparent 50% 100%
        );
    background-size: 7px 7px;
    background-position: 100% 0;
    background-repeat: no-repeat;
    top: 5px;
    background-color: var(--border);
    border: 2px solid var(--border);
    border-radius: 50%;
    right: 12px;
}

.container .pipe-container {
    --width: 100px;
    --duration: 4s;
    position: absolute;
    width: var(--width);
    height: 100%;
    top: 0;
    left: calc(100% + 15px);
    display: grid;
    grid-template-rows: auto 1fr;
    grid-row-gap: 220px;
    animation: run var(--duration) linear forwards;
}

.container .pipe-container .pipe {
    position: relative;
    width: 100%;
    height: 100%;
    background: var(--pipes);
    border: 3px solid var(--border);
    border-bottom-color: transparent;
}

.container .pipe-container .pipe.upper-pipe {
    height: var(--pipeHeight); 
    border-bottom-color: var(--border);
    border-top-color: transparent;
}

.container .pipe-container .pipe.upper-pipe::before,
.container .pipe-container .pipe.lower-pipe::after {
    position: absolute;
    content: "";
    width: calc(100% + 30px);
    height: 60px;
    bottom: -3px;
    left: 50%;
    translate: -50% 0;
    background: var(--pipes);
    box-shadow: var(--shadow);
    border-radius: 4px;
}

.container .pipe-container .pipe.lower-pipe::after {
    bottom: unset;
    top: -3px;
    left: 50%;
}


.container #score {
    font-size: 65px;
    font-weight: 500;
    /* text-shadow: 0px 0px 5px rgba(0,0,0,1); */
    -webkit-text-stroke: 3px black;
    color: white;
    z-index: 10;
    position: absolute;
    top: 20%;
    left: 50%;
    translate: -50% 0;
}

.container .bird.game-over {
    transition: all var(--duration) linear!important;
    rotate: 90deg!important;
    top: calc(100% - var(--width))!important;
}

.game-over > .wing {
    animation: unset!important;
}

/* Animation Keyframes Here */
@keyframes run {
    0% {
        left: 100%;
    }
    100% {
        left: calc((var(--width) + 15px) * -1);
    }
}

@keyframes mountain {
    0% {
        left: 100%;
    }
    100% {
        left: calc((var(--width) + 600px) * -1);
    }
}

@keyframes flap {
    100% {
        rotate: 45deg;
    }
}

@keyframes appear {
    100% {
        opacity: 1;
    }
}

