/* =========================================================
   GLUB — ESCOLHA DO AVENTUREIRO
   ========================================================= */

#avatares-tela {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    display: none;
    z-index: 150;
    background: #f7d98b;
}

.avatares-fundo {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: fill;
    display: block;
    pointer-events: none;
    user-select: none;
    -webkit-user-drag: none;
    z-index: 0;
}

/* =========================================================
   FOLHAGENS DOS CANTOS — MESMA BRISA DO COQUEIRO DO MENU
   ========================================================= */

.avatar-palha {
    position: absolute;
    height: auto;
    display: block;
    pointer-events: none;
    user-select: none;
    -webkit-user-drag: none;
    filter: url("#onda-palmeira");
    transform-origin: 50% 100%;
    z-index: 3;
}

.avatar-palha-esquerda {
    left: -1.2%;
    top: -1.5%;
    width: 23.5%;
}

.avatar-palha-direita {
    right: -1.2%;
    top: -1.5%;
    width: 25.5%;
}

.avatares-lista {
    position: absolute;
    inset: 0;
    z-index: 4;
    pointer-events: none;
}

.avatar-opcao {
    position: absolute;
    bottom: 5.5%;
    width: 12.5%;
    height: 40%;
    min-width: 110px;
    min-height: 190px;
    transform: translateX(-50%);
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    cursor: pointer;
    pointer-events: auto;
    touch-action: manipulation;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    transition: transform 160ms ease, filter 160ms ease;
}

.avatar-opcao img {
    display: block;
    width: auto;
    height: 88%;
    max-width: 100%;
    object-fit: contain;
    pointer-events: none;
    user-select: none;
    -webkit-user-drag: none;
    filter: drop-shadow(0 5px 4px rgba(0,0,0,.25));
    animation: avatarSuspenso 2.2s ease-in-out infinite;
    transform: translateY(-18px);
    will-change: transform;
}

.avatar-opcao:nth-child(2) img { animation-delay: -0.35s; }
.avatar-opcao:nth-child(3) img { animation-delay: -0.70s; }
.avatar-opcao:nth-child(4) img { animation-delay: -1.05s; }
.avatar-opcao:nth-child(5) img { animation-delay: -1.40s; }
.avatar-opcao:nth-child(6) img { animation-delay: -1.75s; }
.avatar-opcao:nth-child(7) img { animation-delay: -2.10s; }

@keyframes avatarSuspenso {
    0%, 100% { transform: translateY(-18px); }
    50% { transform: translateY(-32px); }
}

.avatar-nome {
    margin-top: 2px;
    min-width: 68px;
    padding: 4px 9px 5px;
    border-radius: 12px;
    background: rgba(255,255,255,.94);
    border: 2px solid rgba(94,58,22,.55);
    box-shadow: 0 2px 5px rgba(0,0,0,.22);
    color: #4d2c13;
    font-family: Arial, sans-serif;
    font-size: clamp(12px, 1.25vw, 18px);
    font-weight: 800;
    line-height: 1;
    white-space: nowrap;
    text-align: center;
    pointer-events: none;
}

.avatar-opcao:hover {
    transform: translateX(-50%) translateY(-7px) scale(1.03);
    filter: brightness(1.04);
}

.avatar-opcao:active {
    transform: translateX(-50%) translateY(-2px) scale(.98);
}

.avatar-opcao.selecionado {
    transform: translateX(-50%) translateY(-12px) scale(1.05);
    filter: brightness(1.06);
}

.avatar-opcao.selecionado img {
    filter:
        drop-shadow(0 0 0 rgba(255,255,255,0))
        drop-shadow(0 0 9px rgba(255,226,76,.95))
        drop-shadow(0 6px 5px rgba(0,0,0,.25));
}

.avatar-opcao.selecionado .avatar-nome {
    background: #ffe66b;
    border-color: #9b6b00;
    box-shadow: 0 3px 8px rgba(0,0,0,.28);
}

.avatar-opcao.iniciando {
    animation: avatarPartida 700ms ease both;
}

#avatares-tela.iniciando-aventura .avatar-opcao:not(.iniciando) {
    filter: brightness(.82);
    transform: translateX(-50%) scale(.98);
}

@keyframes avatarPartida {
    0% { transform: translateX(-50%) translateY(0) scale(1); }
    25% { transform: translateX(-50%) translateY(-16px) scale(1.08); }
    55% { transform: translateX(-50%) translateY(-5px) scale(1.04); }
    100% { transform: translateX(-50%) translateY(-26px) scale(1.12); filter: brightness(1.16) drop-shadow(0 0 16px rgba(255,226,76,.95)); }
}

.avatar-opcao:focus {
    outline: none;
}

.avatar-opcao:focus-visible {
    outline: 4px solid rgba(255,255,255,.95);
    outline-offset: 3px;
    border-radius: 18px;
}

#avatar-voltar {
    position: absolute;
    left: 1.5%;
    bottom: 3%;
    width: 48px;
    height: 48px;
    margin: 0;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: rgba(255,255,255,.88);
    color: #174d7a;
    box-shadow: 0 2px 7px rgba(0,0,0,.25);
    font-family: Arial, sans-serif;
    font-size: 30px;
    font-weight: bold;
    line-height: 48px;
    text-align: center;
    cursor: pointer;
    z-index: 10;
    transition: transform 160ms ease, filter 160ms ease;
    touch-action: manipulation;
}

#avatar-voltar:hover {
    transform: scale(1.08);
    filter: brightness(1.06);
}

#avatar-voltar:active {
    transform: scale(.94);
}

#avatar-voltar:focus {
    outline: none;
}

#avatar-voltar:focus-visible {
    outline: 3px solid rgba(23,77,122,.75);
    outline-offset: 3px;
}

@media (max-width: 900px) {
    .avatar-opcao {
        width: 13.5%;
        height: 36%;
        min-width: 86px;
    }

    .avatar-opcao img {
        height: 84%;
    }

    .avatar-nome {
        min-width: 48px;
        padding: 3px 5px 4px;
        font-size: 11px;
    }
}
/* =========================================================
   IDENTIFICAÇÃO DO JOGADOR — após escolher o aventureiro
   ========================================================= */
#jogador-identificacao {
    position: absolute;
    inset: 0;
    z-index: 30;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(18, 49, 63, .28);
    backdrop-filter: blur(1.5px);
}

#jogador-identificacao.visivel { display: flex; }

.jogador-identificacao-caixa {
    width: min(520px, 72%);
    padding: 25px 32px 24px;
    border: 5px solid #6e421c;
    border-radius: 25px;
    background: linear-gradient(#fff0b8, #f2c96f);
    box-shadow: 0 10px 24px rgba(0,0,0,.35), inset 0 0 0 3px rgba(255,255,255,.45);
    text-align: center;
    font-family: Arial, sans-serif;
    color: #4d2c13;
}

#jogador-identificacao-titulo {
    font-size: clamp(20px, 2.1vw, 31px);
    line-height: 1.05;
    font-weight: 900;
    text-shadow: 0 2px 0 rgba(255,255,255,.65);
}

.jogador-identificacao-subtitulo {
    margin: 8px 0 15px;
    font-size: clamp(13px, 1.2vw, 17px);
    font-weight: 700;
}

#jogador-nome {
    box-sizing: border-box;
    width: 82%;
    height: 48px;
    padding: 5px 15px;
    border: 3px solid #8b5a25;
    border-radius: 13px;
    outline: none;
    background: #fffdf4;
    color: #3e2918;
    font-size: clamp(18px, 1.7vw, 24px);
    font-weight: 800;
    text-align: center;
    text-transform: none;
}

#jogador-nome:focus {
    border-color: #1f7191;
    box-shadow: 0 0 0 4px rgba(31,113,145,.2);
}

#jogador-nome-aviso {
    min-height: 20px;
    margin-top: 7px;
    color: #9b281e;
    font-size: 13px;
    font-weight: 900;
}

.jogador-identificacao-acoes {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-top: 5px;
}

.jogador-identificacao-acoes button {
    min-width: 128px;
    padding: 10px 16px;
    border: 3px solid #6e421c;
    border-radius: 14px;
    cursor: pointer;
    color: #4b2a12;
    background: #fff2b8;
    font: 900 15px Arial, sans-serif;
    box-shadow: 0 3px 0 #6e421c;
    touch-action: manipulation;
}

.jogador-identificacao-acoes button:hover { filter: brightness(1.05); transform: translateY(-1px); }
.jogador-identificacao-acoes button:active { transform: translateY(2px); box-shadow: 0 1px 0 #6e421c; }
#jogador-confirmar { background: #ffe05e; }

@media (max-width: 700px) {
    .jogador-identificacao-caixa { width: 76%; padding: 18px 20px; }
    #jogador-nome { width: 92%; }
    .jogador-identificacao-acoes button { min-width: 105px; padding: 8px 11px; }
}
