/* =========================================================
   GLUB — MENU PRINCIPAL
   ========================================================= */

* {
    box-sizing: border-box;
}

html,
body {
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
}

body {
    background: #cfecee;

    display: flex;
    align-items: center;
    justify-content: center;

    overflow: hidden;
}


/* =========================================================
   ÁREA DO JOGO
   ========================================================= */

#game {
    position: relative;

    width: min(100vw, 177.777vh);
    height: min(100vh, 56.25vw);

    aspect-ratio: 16 / 9;

    overflow: hidden;
}


/* =========================================================
   FUNDO
   ========================================================= */

.scene {
    position: absolute;

    inset: 0;

    width: 100%;
    height: 100%;

    object-fit: fill;

    display: block;

    user-select: none;

    pointer-events: none;

    -webkit-user-drag: none;

    z-index: 0;
}


/* =========================================================
   ÁGUA
   ========================================================= */

#waterCanvas {
    position: absolute;

    inset: 0;

    width: 100%;
    height: 100%;

    display: block;

    pointer-events: none;

    z-index: 1;
}

#waterSource {
    display: none;
}


/* =========================================================
   GAIVOTAS DISTANTES
   ========================================================= */

#gull-layer {
    position: absolute;

    inset: 0;

    overflow: hidden;

    z-index: 7;

    pointer-events: none;
}


/* =========================================================
   CONFIGURAÇÃO DAS GAIVOTAS
   ========================================================= */

.flying-gull {
    position: absolute;

    width: 2.7%;
    height: auto;

    display: block;

    pointer-events: none;

    user-select: none;

    -webkit-user-drag: none;

    will-change: left;
}


/* =========================================================
   GAIVOTA — ESQUERDA → DIREITA
   ========================================================= */

.gull-right {

    top: 17%;

    left: -8%;

    width: 2.7%;

    animation:
        voarDireita 34s linear infinite;
}


/* =========================================================
   GAIVOTA — DIREITA → ESQUERDA
   ========================================================= */

.gull-left {

    top: 29%;

    left: 108%;

    width: 2.5%;

    transform: scaleX(-1);

    animation:
        voarEsquerda 37s linear infinite;

    animation-delay: -17s;
}


/* =========================================================
   MOVIMENTO DAS GAIVOTAS
   ========================================================= */

@keyframes voarDireita {

    from {
        left: -8%;
    }

    to {
        left: 108%;
    }

}


@keyframes voarEsquerda {

    from {
        left: 108%;
    }

    to {
        left: -8%;
    }

}


/* =========================================================
   COQUEIRO GRANDE DA DIREITA
   EFEITO DE ONDA — SEM MOVER O COQUEIRO DE LUGAR
   ========================================================= */

#palmeira-direita-frente {

    position: absolute;

    right: -1%;

    top: -2%;

    width: 36%;

    height: auto;

    display: block;

    z-index: 8;

    pointer-events: none;

    user-select: none;

    -webkit-user-drag: none;

    /*
       Efeito semelhante ao Água do Construct 3.
       Produz uma ondulação muito suave nas folhas.
    */
    filter: url("#onda-palmeira");

    transform-origin: 50% 100%;
}


/* =========================================================
   COQUEIROS DA ILHOTA
   ========================================================= */

#palmeiras-ilhota-frente {

    position: absolute;

    inset: 0;

    z-index: 8;

    pointer-events: none;

    background-image:
        url("assets/images/menu/menu-sem-pirateiro.png");

    background-size: 100% 100%;

    background-repeat: no-repeat;

    clip-path: polygon(

        21% 21%,
        30% 21%,
        34% 25%,
        35% 30%,

        34% 34%,
        32% 37%,
        30% 39%,

        27% 38%,
        25% 36%,
        23% 34%,

        20% 34%,
        19% 31%,
        20% 27%,
        20% 24%

    );
}


/* =========================================================
   PIRATEIRO
   ========================================================= */

#ship {

    position: absolute;

    left: -2%;

    top: 28%;

    width: 12%;

    height: auto;

    /*
       Fica à frente da ilha,
       das gaivotas e do coqueiro.
    */

    z-index: 9;

    pointer-events: none;

    user-select: none;

    -webkit-user-drag: none;

    animation:
        navegarPirateiro 10s linear forwards;
}


@keyframes navegarPirateiro {

    from {
        left: -2%;
    }

    to {
        left: 14%;
    }

}


/* =========================================================
   BOTÕES
   ========================================================= */

.menu-btn {

    position: absolute;

    margin: 0;

    padding: 0;

    border: 0;

    background: transparent;

    cursor: pointer;

    z-index: 10;

    transition:
        transform 180ms cubic-bezier(.2, .8, .2, 1),
        filter 180ms ease;

    touch-action: manipulation;
}


.menu-btn img {

    display: block;

    width: 100%;

    height: 100%;

    object-fit: contain;

    pointer-events: none;

    user-select: none;

    -webkit-user-drag: none;
}


/* =========================================================
   INTERAÇÃO DOS BOTÕES
   ========================================================= */

@media (hover: hover) and (pointer: fine) {

    .menu-btn:hover {

        transform: scale(1.035);

        filter: brightness(1.06);
    }

}


.menu-btn:active {

    transform: scale(.965);

    filter: brightness(.98);
}


.menu-btn:focus {

    outline: none;
}


.menu-btn:focus-visible {

    outline:
        3px solid rgba(255, 255, 255, .85);

    outline-offset: 4px;
}


/* =========================================================
   POSIÇÃO DOS BOTÕES
   ========================================================= */

.iniciar {

    left: 3.5%;

    top: 43%;

    width: 16.5%;

    height: 27%;
}


.continuar {

    left: 22.7%;

    top: 51%;

    width: 15.5%;

    height: 24%;
}


.dicas {

    left: 41%;

    top: 51%;

    width: 15.5%;

    height: 24%;
}


.creditos {

    left: 59.5%;

    top: 51%;

    width: 15.5%;

    height: 24%;
}


.fases {

    left: 78%;

    top: 43%;

    width: 16.5%;

    height: 29%;
}


.sair {

    left: 3.5%;

    top: 75%;

    width: 12.5%;

    height: 20.5%;
}


.placar {

    left: 83%;

    top: 76%;

    width: 14%;

    height: 20.5%;
}


/* =========================================================
   GLUB CENTRAL
   ========================================================= */

.glub-btn {

    position: absolute;

    left: 50%;

    top: 15%;

    width: 18%;

    height: auto;

    transform: translateX(-50%);

    z-index: 10;

    border: none;

    padding: 0;

    margin: 0;

    background: transparent;

    cursor: pointer;

    pointer-events: auto;

    transition:
        transform 180ms ease,
        filter 180ms ease;
}


.glub-btn img {

    display: block;

    width: 100%;

    height: auto;

    pointer-events: none;

    user-select: none;

    -webkit-user-drag: none;
}


.glub-btn:hover {

    transform:
        translateX(-50%)
        scale(1.035);

    filter: brightness(1.06);
}


.glub-btn:active {

    transform:
        translateX(-50%)
        scale(.965);
}


/* =========================================================
   CONTROLE DE SOM
   ========================================================= */

#controle-som {

    position: absolute;

    /* Fone global ao lado direito do logo, na faixa superior. */
    left: 0.8%;

    top: 3.5%;

    bottom: auto;

    z-index: 10020;
}


#btn-som {

    width: 34px;

    height: 34px;

    border: none;

    border-radius: 50%;

    background:
        rgba(255, 255, 255, .72);

    box-shadow:
        0 2px 6px rgba(0, 0, 0, .20);

    cursor: pointer;

    display: flex;

    align-items: center;

    justify-content: center;

    padding: 0;

    transition:
        transform 180ms cubic-bezier(.2, .8, .2, 1),
        filter 180ms ease,
        box-shadow 180ms ease;

    touch-action: manipulation;
}


#btn-som:hover {

    transform: scale(1.08);

    filter: brightness(1.06);

    box-shadow:
        0 5px 12px rgba(0, 0, 0, .30);
}


#btn-som:active {

    transform: scale(.94);

    filter: brightness(.97);
}


#icone-som {

    font-size: 20px;

    line-height: 1;

    display: block;

    pointer-events: none;

    user-select: none;
}


#btn-som:focus {

    outline: none;
}


#btn-som:focus-visible {

    outline:
        3px solid rgba(255, 255, 255, .9);

    outline-offset: 3px;
}
/* GLUB — escala lógica única dos avatares */
#game {
    --glub-avatar-tamanho: 164;
    --glub-avatar-largura: calc(var(--glub-avatar-tamanho) / 1280 * 100%);
    --glub-avatar-altura: calc(var(--glub-avatar-tamanho) / 720 * 100%);
}

/* GLUB — ajuste vertical do HUD superior.
   Desloca os quadros sem mover os controles laterais. */
#game .tarefa1-hud-placar {
    translate: 0 -12px;
}

/* GLUB — ajuste interno global do HUD */

#game {
    --glub-hud-deslocamento-interno: 10px;
}

#game .tarefa1-hud .tarefa1-hud-estatistica-icone,
#game .tarefa1-hud .tarefa1-hud-estatistica-valor,
#game .tarefa1-hud .tarefa1-hud-placar-item strong {
    translate: 0 var(--glub-hud-deslocamento-interno) !important;
}
/* GLUB — posição vertical dos objetos do HUD */

#game .tarefa1-hud-estatistica-icone {
    position: relative;
    top: 12px !important;
}