:root {
    /*Main Colors*/
    --mainWhite: #ffefcc;
    --mainGray: #80786e;
    --mainblack: #010010;

    /*Main Fonts*/
    --fontMain: 'Roboto', sans-serif;
    --fontMainSize: 1.5rem;
    --fontLogo: 'Days One', sans-serif;
    --fontLogoSize: 3.5rem;

    /*Difficulty Scaling*/
    --speed-scale: 1;
}

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

body {
    background: var(--mainGray);
    font-family: var(--fontMain);
    color: var(--mainWhite);
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    align-items: center;
    z-index: 100;
}

/*Container z-index:0*/
#container {
    background-color: var(--mainblack);
    border-radius: 5px;
    padding: 0;
    margin: 0 auto;
    width: 100%;
    max-width: 480px;
    height: 100dvh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    z-index: 0;
    overflow: hidden;
    position: relative;
}

/*Header z-index:99*/
header {
    position: fixed;
    top: 0;
    height: 3rem;
    width: 100%;
    max-width: 480px;
    background: linear-gradient(to bottom, rgba(1, 0, 16, 0.8), transparent);
    backdrop-filter: blur(4px);
    display: flex;
    justify-content: center;
    z-index: 9999;
}

nav {
    display: flex;
    justify-content: space-between;
    width: 92%;
    align-items: center;
}

nav>button {
    background: none;
    border: none;
    font-size: 1.6rem;
    color: var(--mainWhite);
    padding: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
    transition: all 0.3s ease;
}

nav>button:hover {
    cursor: pointer;
    color: var(--mainGray);
    transform: scale(1.1);
}

nav>i {
    color: var(--mainWhite);
    margin: .5rem;
}

#gamepad {
    position: absolute;
    margin-top: 90dvh;
    margin-left: 5%;
    background: var(--mainblack);
    border: solid 2px var(--mainWhite);
    color: var(--mainWhite);
    border-radius: 5px;
    padding: .3rem;
    font-size: 1.5rem;
    opacity: .7;
    z-index: 1000;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
    transition: all 0.3s ease;
    z-index: 10000;
}

#gamepad:hover {
    background: var(--mainWhite);
    color: var(--mainblack);
}

/* infoCard Modal Styling */
#infoCard {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(1, 0, 16, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 99999;
    /* Above everything */
    padding: 5rem 0.5rem;
}

#infoCard>article {
    background: rgba(255, 239, 204, 0.15);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    padding: 2.5rem;
    max-width: 400px;
    width: 100%;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.8);
    color: var(--mainWhite);
    position: relative;
    animation: modalShow 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalShow {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(20px);
    }

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

#infoCard article h1 {
    font-family: var(--fontLogo);
    font-size: 2.5rem;
    text-align: center;
    margin-bottom: 1.5rem;
    color: var(--mainWhite);
    text-shadow: 0 0 10px rgba(255, 239, 204, 0.5);
}

#infoCard article h3 {
    font-size: 1.2rem;
    color: var(--mainWhite);
    margin-bottom: 1rem;
    border-bottom: 1px solid rgba(255, 239, 204, 0.3);
    padding-bottom: 0.5rem;
}

#infoCard article p {
    font-size: 1rem;
    line-height: 1.4;
    margin-bottom: 0.8rem;
    opacity: 0.9;
}

#closeInfoCard {
    position: absolute;
    top: 1.2rem;
    right: 1.2rem;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: var(--mainWhite);
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 10;
}

#closeInfoCard:hover {
    background: var(--mainWhite);
    color: var(--mainblack);
    transform: rotate(90deg);
}

#infoCard>footer {
    display: none;
    /* Hide old footer if not needed, or style it inside article */
}

#logoContainer {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 480px;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 97;
}

#logo {
    align-items: center;
    font-family: var(--fontLogo);
    font-size: var(--fontLogoSize);
    color: var(--mainblack);
    text-shadow: 0 2px 0 var(--mainWhite), 2px 0 0 var(--mainWhite), 0 -2px 0 var(--mainWhite), -2px 0 0 var(--mainWhite);
    letter-spacing: .2rem;
    z-index: 10;
}

/*Button Start Game*/
.startGame {
    width: 8rem;
    height: 2.5rem;
    margin: 2rem;
    padding: .5rem;
    background: none;
    border: solid 2px var(--mainWhite);
    color: var(--mainWhite);
    border-radius: 3rem;
    box-shadow: var(--black) 0px 2px 15px;
    letter-spacing: .2rem;
    font-weight: 600;
}

.startGame:hover {
    cursor: pointer;
    background: var(--mainWhite);
    color: var(--mainblack);
    box-shadow: none;
}

#skymoon {
    position: absolute;
    top: 6rem;
    left: 17rem;
    transform: translateX(-50%);
    width: 100%;
    max-width: 480px;
    height: 100%;
    display: flex;
    flex-direction: row;
    justify-content: space-evenly;
    z-index: 1;
    opacity: .7;
    /* Pure background */
    pointer-events: none;
}

#clouds {
    position: absolute;
    top: 1.5rem;
    width: 100%;
    height: 20%;
    display: flex;
    justify-content: space-evenly;
    z-index: 2;
}

.cloud1>img {
    height: 4rem;
    width: 3rem;
    margin-top: 30px;
    animation: slide 20s linear infinite;
}

.cloud2>img {
    height: 4.5rem;
    width: 4rem;
    margin-top: 45px;
    animation: slide 18s linear infinite;
}

.cloud3>img {
    height: 4rem;
    width: 3rem;
    margin-top: -20px;
    animation: slide 22s linear infinite;
}

@keyframes slide {
    0% {
        -webkit-transform: translateX(-900%);
        transform: translateX(-900%);
    }

    100% {
        -webkit-transform: translateX(900%);
        transform: translateX(900%);
    }
}

#moon {
    height: 4.5rem;
    width: 4.5rem;
    position: relative;
    background: var(--mainWhite);
    border-radius: 50%;
    box-shadow: 0 0 80px var(--mainWhite);
    opacity: 0.9;
}

/*footer forest and grave*/
#forest {
    position: absolute;
    bottom: 0px;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 480px;
    height: 25%;
    display: flex;
    flex-direction: row-reverse;
    justify-content: center;
    z-index: 5;
    overflow: hidden;
    pointer-events: none;
}

#tree>img {
    width: 9.3rem;
    height: 9.3rem;
    /* outline: solid 1px orange; */
}

#grave>img {
    width: 2rem;
    height: 2rem;
    margin-top: 100px;
    margin-bottom: 0;
    filter: drop-shadow(-2px 1px 30px var(--mainWhite));
}

/*Game canva*/
#levitateGame {
    display: flex;
    flex-direction: column;
    position: absolute;
    display: none;
    width: 100%;
    max-width: 480px;
    height: 100dvh;
    overflow: hidden;
    z-index: 120;
}

/*Score Card*/
#scoreCard {
    position: absolute;
    margin-top: 90dvh;
    margin-left: 80%;
    padding: .3rem;
    font-size: 1.5rem;
    font-family: var(--fontLogo);
    background: var(--mainblack);
    opacity: .7;
    outline: solid 2px var(--mainWhite);
    border-radius: 5px;
}

/*Floors in game*/
#flexGame {
    overflow-x: hidden;
    overflow-y: visible;
    position: absolute;
    bottom: 0px;
    width: 100%;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    height: auto;
    will-change: transform;
}

#floor {
    position: relative;
    display: flex;
    flex-direction: row;
    justify-content: space-evenly;
    align-items: center;
    width: 100%;
    min-height: 80px;
}

.basefloor {
    box-shadow: 0 3px 1px var(--mainWhite);
}

.floor0 {
    justify-content: space-around;
    width: 100%;
}

/*ghost Player*/
#ghost {
    position: absolute;
    width: 2.3rem;
    height: 3rem;
    animation: baunce 3s infinite;
}

#ghost>img {
    width: 90%;
    height: 90%;
    width: 2.3rem;
    height: 3rem;
    filter: drop-shadow(0px 1px 0px var(--mainblack)) drop-shadow(1px 0px 0px var(--mainblack)) drop-shadow(0px -1px 0px var(--mainblack)) drop-shadow(-1px 0px 0px var(--mainblack));
}

@keyframes baunce {
    0% {
        -webkit-transform: translateY(0);
        transform: translateY(0);
    }

    50% {
        -webkit-transform: translateY(-3px);
        transform: translateY(-3px);
    }

    100% {
        -webkit-transform: translateY(0);
        transform: translateY(0);
    }
}

/*ENEMY PLATFORM*/
#platform {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 160px;
    height: 100%;
}

#monster {
    position: relative;
    display: flex;
    justify-content: center;
}

#monster>img {
    width: auto;
    height: 3.2rem;
    filter: drop-shadow(0px 1px 0px var(--mainblack)) drop-shadow(1px 0px 0px var(--mainblack)) drop-shadow(0px -1px 0px var(--mainblack)) drop-shadow(-1px 0px 0px var(--mainblack));
}

/* .enemy { } */
/* .itemEnemy { } */
/*TYPE MONSTER*/
#avatar {
    animation: move-platform calc(10s / var(--speed-scale)) infinite;
}

#mummy {
    animation: move-platform calc(6s / var(--speed-scale)) infinite;
}

#boodo {
    animation: bounce-move calc(7s / var(--speed-scale)) infinite;
}

#zombie {
    animation: move-platform calc(8s / var(--speed-scale)) infinite;
}

#chunckdevil {
    animation: move-platform calc(5s / var(--speed-scale)) infinite;
}

#vampire {
    animation: fly-floor calc(8s / var(--speed-scale)) infinite;
}

#flyingdevil {
    animation: fly-floor calc(5s / var(--speed-scale)) infinite;
}

#witch {
    animation: bounce-move calc(4s / var(--speed-scale)) infinite;
}

#scaremask {
    animation: move-platform calc(3s / var(--speed-scale)) infinite;
}

#case {
    animation: bounce-move-short calc(3s / var(--speed-scale)) infinite;
}

/*Item Enemy*/
img#eye {
    height: 1.4rem;
    width: 1.2rem;
    animation: eyeItem calc(4s / var(--speed-scale)) infinite;
}

#eye {
    display: block;
}

img#poison {
    height: 2rem;
    width: 1.5rem;
    animation: poisonItem calc(5s / var(--speed-scale)) infinite;
}

img#skull {
    height: 2.2rem;
    width: 2.2rem;
    animation: skullItem calc(5s / var(--speed-scale)) infinite;
}

img#fire {
    height: 1.2rem;
    width: 1.4rem;
}

img#bone {
    height: 1.4rem;
    width: 1.4rem;
    animation: boneItem calc(3s / var(--speed-scale)) infinite;
}

#fire:nth-child(1),
#fire:nth-child(7) {
    animation: fireItem1 calc(5s / var(--speed-scale)) infinite;
}

#fire:nth-child(2),
#fire:nth-child(5) {
    animation: fireItem2 calc(4s / var(--speed-scale)) infinite;
}

#fire:nth-child(3),
#fire:nth-child(6) {
    animation: fireItem3 calc(3s / var(--speed-scale)) infinite;
}

/*Enemy Animation*/
@keyframes move-platform {
    30% {
        -webkit-transform: translateX(70px);
        transform: translateX(70px);
    }

    70% {
        -webkit-transform: translateX(-70px);
        transform: translateX(-70px);
    }
}

@keyframes fly-floor {
    0% {
        transform: translate3d(200px, 18px, 0);
    }

    100% {
        transform: translate3d(-200px, -14px, 0);
    }
}

@keyframes bounce-move {
    0% {
        transform: translate3d(-160px, 0, 0) translateY(0);
    }

    25% {
        transform: translate3d(-80px, -10px, 0) translateY(-10px);
    }

    50% {
        transform: translate3d(0, 0, 0) translateY(0);
    }

    75% {
        transform: translate3d(80px, -10px, 0) translateY(-10px);
    }

    100% {
        transform: translate3d(160px, 0, 0) translateY(0);
    }
}

@keyframes bounce-move-short {
    0% {
        transform: translate3d(-80px, 0, 0) translateY(0);
    }

    50% {
        transform: translate3d(0px, -15px, 0) translateY(-15px);
    }

    100% {
        transform: translate3d(80px, 0, 0) translateY(0);
    }
}

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

    25% {
        transform: rotate(0deg);
    }

    50% {
        transform: rotate(-10deg);
    }

    75% {
        transform: rotate(0deg);
    }

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

@keyframes eyeItem {
    0% {
        transform: translate3d(-150px, 0, 0) scale(1);
    }

    30% {
        transform: translate3d(0px, -5px, 0) scale(1.2);
    }

    60% {
        transform: translate3d(150px, 0, 0) scale(1);
    }

    90% {
        transform: translate3d(0px, 5px, 0) scale(1.2);
    }

    100% {
        transform: translate3d(-150px, 0, 0) scale(1);
    }
}

@keyframes poisonItem {
    0% {
        transform: translate3d(0px, 0px, 0px);
    }

    16% {
        transform: translate3d(-160px, 10px, 0);
    }

    33% {
        transform: translateY(-10px);
    }

    64% {
        transform: translate3d(160px, -10px, 0px);
    }

    80% {
        transform: translateY(20px);
    }

    100% {
        transform: translateX(0px);
    }
}

@keyframes skullItem {
    0% {
        transform: translateX(0px);
    }

    8% {
        transform: rotate(45deg);
    }

    16% {
        transform: translate3d(-280px, -10px, 0);
    }

    24% {
        transform: rotate(-45deg);
    }

    33% {
        transform: translateY(-10px);
    }

    45% {
        transform: rotate(45deg);
    }

    64% {
        transform: translate3d(280px, 20px, 0px);
    }

    72% {
        transform: rotate(-45deg);
    }

    80% {
        transform: translateY(20px);
    }

    92% {
        transform: rotate(45deg);
    }

    100% {
        transform: translateX(0px);
    }
}

@keyframes fireItem1 {
    0% {
        transform: translateY(20px);
    }

    25% {
        transform: translateX(-80px);
    }

    50% {
        transform: translateY(-20px);
    }

    75% {
        transform: translateX(80px);
    }

    100% {
        transform: translateY(20px);
    }
}

@keyframes fireItem2 {
    0% {
        transform: translateY(10px);
    }

    25% {
        transform: translateX(-60px);
    }

    50% {
        transform: translateY(-20px);
    }

    75% {
        transform: translateX(60px);
    }

    100% {
        transform: translateY(10px);
    }
}

@keyframes fireItem3 {
    0% {
        transform: translateY(5px);
    }

    25% {
        transform: translateX(-30px);
    }

    50% {
        transform: translateY(-20px);
    }

    75% {
        transform: translateX(30px);
    }

    100% {
        transform: translateY(5px);
    }
}

@keyframes boneItem {
    20% {
        transform: translateX(120px) rotate(360deg);
    }

    80% {
        transform: translateX(-120px) rotate(-360deg);
    }
}

/*Floor Platform*/
#platfomFloor {
    position: relative;
    height: .3rem;
    width: 100%;
    background: url(../src/img/enviorment/brickfloor.svg);
    outline: double 2px var(--mainWhite);
    border: dashed 1px var(--mainGray);
    box-shadow: 0 3px 0px var(--mainGray);
}

.enemyPlatform1 {
    position: relative;
    display: flex;
    flex-direction: row;
    justify-content: space-around;
}

.enemyPlatform2 {
    position: relative;
    display: flex;
    flex-direction: row;
    justify-content: left;
}

.enemyPlatform3 {
    position: relative;
    display: flex;
    flex-direction: row;
    justify-content: center;
}

.enemyPlatform4 {
    position: relative;
    display: flex;
    flex-direction: row;
    justify-content: space-between;
}

.enemyPlatform5 {
    position: relative;
    display: flex;
    flex-direction: row;
    justify-content: right;
}

/*Controls*/
#controlGame {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    max-width: 480px;
    height: 100dvh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: transparent;
    z-index: 1000;
}

#gridGameControl {
    position: relative;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: repeat(3, 1fr);
    grid-column-gap: 1px;
    grid-row-gap: 1px;
    height: 90dvh;
    width: 100%;
    z-index: 1010;
}

#upControl {
    grid-area: 1 / 1 / 2 / 3;
    height: 100%;
    width: 100%;
}

#leftControl {
    grid-area: 2 / 1 / 3 / 2;
    height: 100%;
    width: 100%;
}

#rightControl {
    grid-area: 2 / 2 / 3 / 3;
    height: 100%;
    width: 100%;
}

#downControl {
    grid-area: 3 / 1 / 4 / 3;
    height: 100%;
    width: 100%;
}

.controlButton {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100%;
    width: 100%;
    border: none;
    background: transparent;
    opacity: 0;
    transition: opacity 0.3s ease, background 0.3s ease;
}

.controlButton.showHelp {
    opacity: 1 !important;
    background: rgba(255, 239, 204, 0.02);
    border: 1px dashed rgba(255, 239, 204, 0.2);
}

.controlButton>i {
    font-size: 5rem;
    color: var(--mainWhite);
    text-shadow: 0 0 10px var(--mainblack);
}

.controlButton:active {
    background: rgba(255, 239, 204, 0.1);
}

/* Modal Styling */
.modal {
    position: absolute;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    z-index: 2000;
    background-color: rgba(1, 0, 16, 0.9);
    padding: 2rem;
}

.modal>article {
    background-color: var(--mainWhite);
    color: var(--mainblack);
    padding: 2rem;
    border-radius: 10px;
    text-align: center;
    box-shadow: 0 0 20px var(--mainWhite);
    max-width: 90%;
}

.modal h1 {
    font-size: 1.2rem;
    margin-bottom: 2rem;
    line-height: 1.4;
}

.resultContainer {
    display: flex;
    justify-content: space-around;
    margin-bottom: 2rem;
}

.scoreResult p {
    font-size: 0.8rem;
    color: var(--mainGray);
    margin-bottom: 0.5rem;
}

.scoreResult h2 {
    font-family: var(--fontLogo);
}

#restartBtn {
    border-color: var(--mainblack);
    color: var(--mainblack);
}

#restartBtn:hover {
    background: var(--mainblack);
    color: var(--mainWhite);
}

#brandingFooter {
    position: absolute;
    bottom: 0.5rem;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    pointer-events: none;
}

#brandingFooter p {
    font-family: var(--fontMain);
    font-size: 0.75rem;
    color: var(--mainWhite);
    opacity: 0.6;
    background: rgba(1, 0, 16, 0.4);
    backdrop-filter: blur(4px);
    padding: 0.2rem 0.8rem;
    border-radius: 20px;
    pointer-events: auto;
}

#brandingFooter a {
    color: var(--mainWhite);
    text-decoration: none;
    font-weight: bold;
}

#brandingFooter a:hover {
    text-decoration: underline;
    opacity: 1;
}