html,
body {
    margin: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #6ec6ff;
    font-family: Arial, sans-serif
}


body:fullscreen #game {
    width: 100vw;
    height: 100vh
}

html:fullscreen {
    background: #87d8ff
}

#container {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center
}

#game {
    width: 100%;
    height: 100%;
    background: #87d8ff
}

#fim {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10
}

.caixa-final {
    width: 90%;
    max-width: 450px;
    background: white;
    padding: 30px;
    border-radius: 25px;
    text-align: center;
    font-family: Arial;
    animation: subir .5s
}

.caixa-final h1 {
    color: #ff9800;
    font-size: 42px
}

.caixa-final h2 {
    color: #2196f3
}

.caixa-final button {
    margin-top: 25px;
    padding: 15px 30px;
    border: 0;
    border-radius: 20px;
    background: #4caf50;
    color: white;
    font-size: 20px;
    cursor: pointer
}

#girar-tela {
    display: none;
    position: fixed;
    inset: 0;
    background: #87d8ff;
    z-index: 9999;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: white;
    font-family: Arial
}

#girar-tela div {
    background: rgba(0, 0, 0, .3);
    padding: 30px;
    border-radius: 30px;
    margin: 80px;

}

#girar-tela {
    font-size: 70px
}

#girar-tela h2 {
    font-size: 32px
}

#girar-tela p {
    font-size: 18px
}

#update-game {
    position: fixed;
    left: 50%;
    bottom: 25px;
    transform: translateX(-50%);
    background: #242424;
    color: #fff;
    border-radius: 15px;
    padding: 15px 20px;
    display: none;
    align-items: center;
    gap: 15px;
    z-index: 99999;
    box-shadow: 0 10px 25px rgba(0, 0, 0, .35);
}

#update-game button {
    border: none;
    background: #38b000;
    color: white;
    padding: 10px 18px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
}

@media(max-width:900px) {
    #start-game {
        display: flex
    }
}

@media(max-width:900px) and (orientation:portrait) {

    #girar-tela {
        display: flex
    }

}

@media(max-width:900px) {

    #controle-mobile {
        display: flex
    }

}

@keyframes subir {
    from {
        transform: scale(.5)
    }

    to {
        transform: scale(1)
    }
}

#mobile-controls {
    display: none
}


@media(max-width:900px) {

    #mobile-controls {
        display: flex;
        position: fixed;
        left: 0;
        bottom: 35px;
        width: 100%;
        justify-content: space-between;
        align-items: flex-end;
        padding: 0 60px;
        box-sizing: border-box;
        z-index: 9999;
        pointer-events: none
    }


    .controle-esquerda,
    .controle-direita {
        display: flex;
        gap: 20px;
        pointer-events: auto
    }


    .controle-direita {
        align-items: flex-end
    }


    #mobile-controls button {
        width: 95px;
        height: 95px;
        background: none;
        border: 0;
        padding: 0;
        outline: none;
        cursor: pointer;
        touch-action: none;
        user-select: none;
        -webkit-user-select: none
    }


    #mobile-controls img {
        width: 100%;
        height: 100%;
        object-fit: contain;
        pointer-events: none;
        filter:
            drop-shadow(0 8px 8px rgba(0, 0, 0, .35))
    }


    #mobile-controls button:active {

        transform:
            scale(.88)
    }

}



@media(max-height:450px) {
    #mobile-controls {
        bottom: 20px;
        padding: 0 45px
    }

    #mobile-controls button {
        width: 75px;
        height: 75px
    }
}

#menu-game {
    position: fixed;
    top: 15px;
    right: 15px;
    z-index: 999999;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity .25s;
}

#menu-game.ativo {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

#btn-menu {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    width: 40px;
    height: 40px;
    padding: 0;
    border: none;
    background: transparent;
    cursor: pointer;
}

#btn-menu span {
    width: 6px;
    height: 6px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 0 5px rgba(0, 0, 0, .6);
    transition: .2s;
}

#btn-menu:hover span {
    transform: scale(1.25);
}

#menu-dropdown {
    position: absolute;
    top: 45px;
    right: 0;
    display: none;
    flex-direction: column;
    min-width: 220px;
    background: rgba(25, 25, 25, .96);
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, .45);
}

#menu-dropdown.aberto {
    display: flex;
}

#menu-dropdown button {
    border: none;
    background: none;
    color: #fff;
    padding: 14px 18px;
    text-align: left;
    cursor: pointer;
    transition: .2s;
}

#menu-dropdown button:hover {
    background: #3d7cff;
}

#ranking-modal {
    position: fixed;
    inset: 0;
    display: none;
    justify-content: center;
    align-items: center;
    background: rgba(0, 0, 0, .65);
    z-index: 999999;
    backdrop-filter: blur(8px);
}

#ranking-modal.aberto {
    display: flex;
}

.ranking-window {

    width: min(500px, 92vw);
    max-height: 85vh;

    overflow: hidden;

    border-radius: 30px;

    background:
        linear-gradient(180deg,
            #56c6ff,
            #2d84ff);

    box-shadow:
        0 20px 50px rgba(0, 0, 0, .35);

    animation: rankingShow .25s;

}

@keyframes rankingShow {

    from {

        transform: scale(.85);

        opacity: 0;

    }

    to {

        transform: scale(1);

        opacity: 1;

    }

}

.ranking-header {
    padding: 30px 20px 20px;
    text-align: center;
    color: #fff;
}

.ranking-trophy {
    font-size: 35px;
    animation: trofeu 1.8s infinite alternate;
}

@keyframes trofeu {
    from {
        transform: translateY(0);
    }

    to {
        transform: translateY(-6px);
    }
}

.ranking-header h2 {
    margin: 10px 0 4px;
    font-size: 34px;
}

.ranking-header p {
    opacity: .85;
}

#ranking-lista {
    padding: 15px;
    max-height: 420px;
    overflow: auto;
}

.ranking-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 14px;
    margin-bottom: 10px;
    border-radius: 18px;
    background: #ffffff22;
    color: #fff;
}

.ranking-posicao {
    width: 40px;
    font-size: 22px;
    font-weight: bold;
    text-align: center;
}

.ranking-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: #fff;
    color: #2d84ff;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: bold;
    font-size: 20px;
}

.ranking-nome {
    flex: 1;
    font-weight: bold;
}

.ranking-pontos {
    background: #ffd83d;
    color: #222;
    padding: 6px 14px;
    border-radius: 20px;
    font-weight: bold;
}

.ranking-item.top1 {
    background: linear-gradient(90deg,
            #ffd83d,
            #ffb300);
    color: #222;
}

.ranking-item.top2 {
    background: linear-gradient(90deg,
            #dfe6ec,
            #b9c3cc);
    color: #222;
}

.ranking-item.top3 {
    background: linear-gradient(90deg,
            #ffcb9b,
            #e79d55);
    color: #222;
}

#ranking-fechar {
    width: 100%;
    border: none;
    background: #1b63d6;
    color: #fff;
    padding: 18px;
    font-size: 18px;
    cursor: pointer;
}

@media (max-width:900px) {

    .ranking-window {

        width: 95vw;
        max-height: 88vh;

    }

    .ranking-header {

        display: flex;
        align-items: center;
        justify-content: flex-start;
        gap: 16px;

        padding: 18px 20px;

        text-align: left;

    }

    .ranking-trophy {

        flex-shrink: 0;

        font-size: 52px;

        margin: 0;

    }

    .ranking-header h2 {

        margin: 0;

        font-size: 32px;

        line-height: 1;

    }

    .ranking-header p {

        margin-top: 4px;

        font-size: 15px;

        opacity: .9;

    }

    #ranking-lista {

        max-height: calc(88vh - 170px);

    }

}