/* =========================================================
   LAYOUT.CSS — MOLDURA GERAL DO APP
   ---------------------------------------------------------
   Regra:
   - O jogo é mobile-first.
   - Desktop apenas centraliza a experiência mobile.
   - Header e footer globais ficam aqui.
   - O pergaminho é uma camada fixa por trás do conteúdo.
========================================================= */

html,
body {
    min-height: 100%;
    overflow-x: hidden;
}

body {
    display: flex;
    justify-content: center;
    align-items: stretch;

    background: #ead6a8;
}

/* =========================================================
   CONTAINER PRINCIPAL
========================================================= */

#game-container {
    position: relative;

    width: min(920px, 100vw);
    min-height: 100dvh;
    height: auto;

    margin: 0 auto;
    padding: 76px 16px 64px;

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

    overflow-x: hidden;
    overflow-y: visible;

    background-color: #f4ead2;
    background-image: none;

    box-sizing: border-box;
}

/*
   Técnica recuperada do backup:
   o pergaminho fica em uma camada visual fixa,
   sem repetir e sem esticar o container.
*/
#game-container::before {
    content: "";
    position: fixed;

    top: 0;
    left: 50%;
    transform: translateX(-50%);

    width: min(920px, 100vw);
    height: 100dvh;

    z-index: 0;
    pointer-events: none;

    background-image: url("../assets/fundos/pergaminho-mobile.webp");
    background-size: cover;
    background-position: center top;
    background-repeat: no-repeat;
    background-color: #f4ead2;
}

#game-container>section {
    position: relative;
    z-index: 2;

    width: 100%;
    max-width: 100%;

    box-sizing: border-box;
}

/* =========================================================
   GARANTIA — TELAS TRANSPARENTES SOBRE O PERGAMINHO
========================================================= */

#tela-apresentacao,
#tela-faixa-etaria,
#tela-login,
#tela-mapa,
#tela-introducao-ilha,
#tela-jogo,
#tela-conquistas {
    background: transparent;
}

/* =========================================================
   HEADER GLOBAL DO JOGO
========================================================= */

#game-header {
    position: absolute;
    top: 14px;
    left: 50%;
    transform: translateX(-50%);

    width: min(386px, calc(100vw - 32px));
    max-width: 386px;

    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;

    padding: 0;

    z-index: 20;
    pointer-events: none;
}

#game-header.hidden {
    display: none !important;
}


.btn-audio-toggle {
    pointer-events: auto;
    width: 42px;
    min-width: 42px;
    height: 42px;
    border: 3px solid var(--orange);
    border-radius: 999px;
    background: rgba(255, 253, 248, 0.96);
    color: var(--ocean-dark);
    font-size: 1rem;
    line-height: 1;
    font-weight: 900;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow:
        0 4px 10px rgba(0, 0, 0, 0.12),
        inset 0 0 0 2px rgba(255, 255, 255, 0.72);
}

.btn-audio-toggle:active {
    transform: translateY(1px);
}
#stats-moedas,
#perfil-player {
    pointer-events: auto;

    display: inline-flex;
    align-items: center;

    min-height: 42px;

    background: rgba(255, 253, 248, 0.96);
    border: 3px solid var(--orange);
    border-radius: 999px;

    color: var(--ocean-dark);
    font-weight: 900;

    box-shadow:
        0 4px 10px rgba(0, 0, 0, 0.12),
        inset 0 0 0 2px rgba(255, 255, 255, 0.72);
}

#stats-moedas {
    width: 68px;
    min-width: 68px;
    max-width: 68px;

    justify-content: center;
    gap: 5px;

    padding: 4px 8px;

    font-size: 0.92rem;
    line-height: 1;
}

#stats-moedas span {
    font-size: 0.96rem;
    font-weight: 900;
}

#perfil-player {
    width: 182px;
    min-width: 182px;
    max-width: 182px;

    justify-content: flex-start;
    gap: 8px;

    padding: 4px 10px 4px 6px;

    overflow: hidden;
}

#avatar-player {
    width: 28px;
    height: 28px;

    padding: 0;
    border: none;
    border-radius: 0;
    background: transparent;
    box-shadow: none;

    object-fit: cover;
    object-position: center top;

    flex-shrink: 0;
    display: block;
}

#nome-player-texto {
    display: block;

    width: 120px;
    max-width: 120px;
    min-width: 0;

    font-size: 0.72rem;
    line-height: 1.04;
    font-weight: 900;

    text-align: left;
    white-space: normal;
    overflow-wrap: normal;
    word-break: normal;

    color: var(--ocean-dark);
}

/* =========================================================
   FOOTER GLOBAL
========================================================= */

#game-footer {
    position: fixed;
    left: 50%;
    bottom: 8px;
    transform: translateX(-50%);

    width: min(396px, calc(100vw - 34px));
    min-height: 26px;

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

    padding: 5px 12px;

    border-radius: 999px;

    background: rgba(255, 253, 248, 0.86);
    color: #2e4663;

    font-size: 0.62rem;
    line-height: 1.15;
    font-weight: 700;
    text-align: center;

    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.10);
    backdrop-filter: blur(4px);

    z-index: 30;
    pointer-events: none;

    box-sizing: border-box;
}

/* =========================================================
   BANNERS DE FAIXA ETÁRIA
========================================================= */

.faixa-banner-wrap {
    display: flex;
    justify-content: center;
    align-items: center;

    margin: 14px auto 22px;
}

.banner-faixa-idade {
    display: block;

    width: min(350px, 84vw);
    height: auto;

    object-fit: contain;
}

.faixa-banner-wrap-mapa {
    margin: 12px auto 20px;
}

.banner-faixa-idade-mapa {
    width: min(330px, 82vw);
}

/* =========================================================
   MOBILE LANDSCAPE — CONTAINER MAIS LARGO
========================================================= */

@media (max-width: 900px) and (orientation: landscape) {
    #game-container {
        width: min(760px, 100vw);

        padding-top: 54px;
        padding-left: 22px;
        padding-right: 22px;
        padding-bottom: 64px;
    }

    #game-container::before {
        width: min(760px, 100vw);
        height: 100dvh;

        background-size: cover;
        background-position: center top;
        background-repeat: no-repeat;
    }

    #game-header {
        top: 8px;
        width: min(620px, calc(100vw - 44px));
        max-width: 620px;
    }

    #stats-moedas {
        width: 64px;
        min-width: 64px;
        max-width: 64px;
        min-height: 40px;

        padding: 4px 8px;

        font-size: 0.88rem;
    }

    #stats-moedas span {
        font-size: 0.92rem;
    }

    #perfil-player {
        width: 174px;
        min-width: 174px;
        max-width: 174px;
        min-height: 40px;
    }

    #avatar-player {
        width: 26px;
        height: 26px;
    }

    #nome-player-texto {
        width: 118px;
        max-width: 118px;

        font-size: 0.70rem;
        line-height: 1.02;
    }

    #game-footer {
        width: min(620px, calc(100vw - 44px));
        font-size: 0.58rem;
        padding: 5px 10px;
    }
}

/* =========================================================
   TELAS MUITO ESTREITAS
========================================================= */

@media (max-width: 380px) {
    #game-container {
        padding-top: 70px;
        padding-left: 14px;
        padding-right: 14px;
        padding-bottom: 64px;
    }

    #game-container::before {
        width: 100vw;
    }

    #game-header {
        width: min(342px, calc(100vw - 28px));
        gap: 6px;
    }

    #stats-moedas {
        width: 62px;
        min-width: 62px;
        max-width: 62px;
        min-height: 40px;

        padding: 4px 7px;

        font-size: 0.84rem;
    }

    #perfil-player {
        width: 160px;
        min-width: 160px;
        max-width: 160px;
        min-height: 40px;
    }

    #avatar-player {
        width: 25px;
        height: 25px;
    }

    #nome-player-texto {
        width: 108px;
        max-width: 108px;

        font-size: 0.68rem;
    }
}

/* =========================================================
   DESKTOP — APP MOBILE CENTRALIZADO SEM CORTE
========================================================= */

@media (min-width: 901px) {
    #game-container {
        width: min(920px, 100vw);
        max-width: 920px;
        min-height: 100dvh;

        padding-left: 16px;
        padding-right: 16px;

        overflow-x: hidden;
        overflow-y: visible;
    }

    #game-container::before {
        width: min(920px, 100vw);
        height: 100dvh;

        background-size: cover;
        background-position: center top;
        background-repeat: no-repeat;
    }

    #game-container>section {
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
        box-sizing: border-box;
    }

    #tela-apresentacao,
    #tela-faixa-etaria,
    #tela-login,
    #tela-mapa,
    #tela-introducao-ilha,
    #tela-conquistas,
    #tela-jogo {
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
        box-sizing: border-box;
    }

    #tela-mapa,
    #tela-introducao-ilha,
    #tela-conquistas,
    #tela-jogo {
        max-width: 430px;
        margin-left: auto;
        margin-right: auto;
    }

    .painel-inicial-premium,
    .login-box,
    .escolha-navegador-box,
    .intro-ilha-box,
    .intro-ilha-mobile-style {
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
        overflow-x: hidden;
    }

    .banner-escolha,
    .banner-faixa-idade,
    .banner-faixa-idade-mapa,
    .banner-introducao-ilha,
    .banner-missoes-ilha,
    .banner-modulo {
        max-width: 100%;
        height: auto;
        object-fit: contain;
    }

    .faixa-banner-wrap {
        width: 100%;
        max-width: 100%;
        overflow: hidden;
    }

}
