
/* === FONTS E GLOBAIS === */
@font-face {
    font-family: 'Poppins';
    src: url(./fonts/Poppins-Regular.ttf) format('truetype');
    font-weight: normal;
}

@font-face {
    font-family: 'Poppins';
    src: url(./fonts/Poppins-Bold.ttf) format('truetype');
    font-weight: bold;
}

* {
    font-family: 'Poppins', sans-serif !important;
}

html, body {
    margin: 0;
    padding-top: min(2vh, 20px);
    padding-bottom: min(3vh, 10px);
    height: 100dvh;
    width: 100vw;
    overflow: hidden;
    background: #6e5c62;
    display: flex;
    flex-direction: column;
    align-items: center;
    color: #ffffff;
    font-family: 'Poppins', sans-serif;
    justify-content: flex-start;
    gap: 1vh;
    box-sizing: border-box;
}

/* === HEADER === */
header {
    position: relative;
    width: 100%;
    max-height: 500px;
    display: flex;
    justify-content: center;
    align-items: center;
}


header h1 {
    margin-top: 15px;
    letter-spacing: 1px;
    font-size: min(5vh, 2.5rem);
    text-align: center;
}

#btn-estatisticas {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-20%);
    background: none;
    border: none;
    padding: 0;
    font-size: min(4vh, 24px);
    cursor: pointer;
    opacity: 0.8;
    transition: transform 0.2s ease;
    display: none;
    justify-content: center;
    align-items: center;
}

#btn-estatisticas svg {
    display: block;
}

#btn-estatisticas:hover {
    opacity: 1;
    transform: translateY(-20%) scale(1.1);
}

/* === TABULEIRO === */
#tabuleiro {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: min(1.5vh, 1.5vw, 8px);
    margin-bottom: min(2vh, 15px);
    margin-top: auto;
}

.quadradinho {
    width: min(6vh, 15vw, 75px);
    height: min(6vh, 15vw, 75px);
    background-color: #615458;
    box-sizing: border-box;
    border: 2px solid #615458;
    border-radius: 0.8vh;
    display: flex;
    justify-content: center;
    align-items: center;
    font-family: 'Poppins', sans-serif;
    font-size: min(4vh, 8vw, 3rem);
    font-weight: bold;
    text-transform: uppercase;
}

.quadradinho.linha-ativa {
    border: 2px solid #3a3a3c !important;
}

.quadradinho.selecionado {
    border-bottom: min(1vh, 2vw, 6px) solid #3a3a3c !important;
}

/* === TECLADO VIRTUAL === */
#teclado {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: min(1vh, 1.5vw, 6px);
    width: 100%;
    max-width: min(500px, 75vh);
    flex-shrink: 0;
    min-width: min(100%, 300px);
    padding: 0 min(2vw, 8px);
    box-sizing: border-box;
    margin-top: 0;
    margin-bottom: 0;
}

.linha-teclado {
    display: flex;
    width: 100%;
    gap: min(1vw, 6px);
    justify-content: center;
}

.linha-teclado:nth-child(2) {
    width: 90%;
}

.tecla {
    background-color: #4c4347;
    color: white;
    border: none;
    border-radius: 6px;
    flex: 1;
    min-width: 0;
    min-height: 30px;
    height: min(7vh, 55px);
    font-family: 'Poppins', sans-serif;
    font-weight: bold;
    font-size: min(2.2vh, 4vw, 18px);
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0;
    touch-action: manipulation;
}

.tecla:hover {
    background-color: #615458;
}

#ENTER {
    flex: 1.5;
    font-size: min(2vh, 3vw, 16px);
}

#⌫ {
    flex: 1.3;
    font-size: min(2.2vh, 3.5vw, 15px);
}

/* === CORES E ESTADOS === */
.correta {
    background-color: #3aa394 !important;
    border: 2px solid #3aa394 !important
}

.presente {
    background-color: #d3ad69 !important;
    border: 2px solid #d3ad69 !important
}

.ausente {
    background-color: #312a2c !important;
    border: 2px solid #312a2c !important
}

/*.preenchido {
    border: 2px solid #3a3a3c;
}*/

.tecla.correta, .tecla.presente, .tecla.ausente {
    color: white !important;
    transition: background-color 0.2s;
}

.tecla.ausente {
    background-color: #4c4347 !important;
    border: none !important;
    opacity: 0.3;
}

/* === ANIMAÇÕES TABULEIRO === */
@keyframes flip {
    0% {
        transform: rotateY(0deg);
    }

    50% {
        transform: rotateY(90deg);
    }

    100% {
        transform: rotateY(0deg);
    }
}


.quadradinho.flip {
    animation: flip 0.5s ease-in;
}

/* === NOTIFICAÇÕES === */
#container-notificacoes {
    position: fixed;
    top: 10%;
    left: 50%;
    transform: translateX(-50%);
    display: grid;
    place-items: center;
    gap: 10px;
    z-index: 1000;
    pointer-events: none;
}

.notificacao {
    grid-area: 1 / 1;
    background-color: #1266e4;
    color: white;
    padding: 15px 20px;
    font-weight: bold;
    font-size: 16px;
    opacity: 1;
    cursor: pointer;
    pointer-events: auto;
    border-radius: 10px;
    text-align: center;
    justify-content: center;
    display: flex;
    align-items: center;
    animation: popup 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.notificacao.esconder {
    opacity: 0;
    transform: scale(0.8);
}

.notificacao.animacao {
    animation: popout 0.3s ease forwards;
}


@keyframes popup {

    0% {
        opacity: 1;
        transform: scale(0);
    }

    100% {
        opacity: 1;
        transform: scale(1);
    }
}


@keyframes popout {

    0% {
        opacity: 1;
        transform: scale(1);
    }

    100% {
        opacity: 1;
        transform: scale(0);
    }
}


@keyframes fadeIn {

    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}


@keyframes popUpCaixa {

    from {
        transform: scale(0.8);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}


@keyframes fadeOutGeral {

    from {
        opacity: 0;
    }
}

/* === MODAL DE FIM DE JOGO === */
#modal-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    animation: fadeIn 0.3s ease-out;
}

#modal-conteudo {
    background-color: #4c4347;
    width: min(530px, 90vw, 70vh);
    max-width: 90vw;
    max-height: 90vh;
    padding: min(2em, 3vh) min(2em, 3vh);
    border-radius: 8px;
    text-align: center;
    color: white;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.6);
    animation: popUpCaixa 0.3s ease-out;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    gap: min(2vh, 15px);
    box-sizing: border-box;
    overflow-y: auto;
}

#modal-conteudo h2 {
    font-size: min(2rem, 4.5vh);
    margin: 0;
    margin-bottom: 1vh;
}

#modal-conteudo p {
    font-size: min(1.2rem, 2.5vh);
    margin: 0;
}

.estatisticas-resumo {
    display: flex;
    justify-content: space-around;
    margin: 0;
    padding: 1vh 0;
    text-align: center;
    font-size: min(14px, 2vh);
}

.estat-item strong {
    font-size: min(24px, 4.5vh);
    display: block;
}

#modal-conteudo h3 {
    font-size: min(1.1rem, 2.8vh);
    margin: 0;
    padding: 0.5vh 0;
    letter-spacing: 1px;
}

.grafico-distribuicao {
    display: flex;
    flex-direction: column;
    gap: 0.5vh;
    margin-bottom: 0;
}

.linha-grafico {
    display: flex;
    align-items: stretch;
    gap: 10px;
    font-size: min(14px, 2.2vh);
    font-weight: bold;
    height: 1.6em;
    width: 100%;
}

.linha-grafico span {
    width: 20px;
    text-align: center;
    flex-shrink: 0;
}

.barra {
    padding: 0;
    color: white;
    box-sizing: border-box;
    font-weight: bold;
    display: flex;
    height: 100%;
    line-height: 1;
    align-items: center;
    justify-content: flex-end;
}

.barra:not(.barra-zero) {
    padding-right: 8px;
}

.barra.barra-zero {
    justify-content: center;
    margin-left: 0;
}


.barra-cinza {
    background-color: #312a2c;
}

.barra-verde {
    background-color: #3aa394;
}

#btn-fechar-modal {
    background-color: #3aa394 !important;
    color: white !important;
    font-weight: bold !important;
    padding: 1.5vh 30px;
    border: none;
    border-radius: 4px;
    font-size: min(1.1rem, 2.5vh);
    cursor: pointer;
    outline: none;
    margin-top: auto;
    -webkit-tap-highlight-color: transparent;
}

.sumir {
    opacity: 0 !important;
    transition: opacity 0.2s ease-out !important;
    pointer-events: none;
}

/* === PAINEL MULTIPLAYER === */
#painel-multiplayer {
    position: absolute;
    left: min(2vw, 10px);
    top: min(10vh, 70px);
    display: flex;
    flex-direction: column;
    gap: min(2vh, 15px);
    padding: min(1.5vh, 10px);
    background-color: transparent;
    z-index: 10;
    height: calc(100vh - 100px);
    overflow-y: auto;
    width: max-content;
}

#painel-multiplayer::-webkit-scrollbar {
    width: 4px
}

#painel-multiplayer::-webkit-scrollbar-thumb {
    background-color: #615458;
    border-radius: 10px;
}

#lista-amigos {
    display: flex;
    flex-direction: column;
    gap: min(2vh, 15px);
}

.amigo-container {
    display: flex;
    align-items: center;
    gap: min(2vh, 3vw, 15px);
    background-color: transparent;
    border: 2px solid #615458;
    border-radius: 8px;
    padding: min(1.5vh, 3vw, 12px) min(2vh, 4vw, 16px);
}

.avatar-amigo {
    width: min(8vh, 16vw, 65px);
    height: min(8vh, 16vw, 65px);
    border-radius: 50%;
    object-fit: cover;
    border: min(0.3vh, 0.6vw, 2px) solid #615458;
}

.mini-grid {
    display: grid;
    grid-template-columns: repeat(5, min(1.5vh, 3vw, 12px));
    grid-gap: min(0.4vh, 1vw, 3px);
}

.mini-quadrado {
    width: min(1.5vh, 3vw, 12px);
    height: min(1.5vh, 3vw, 12px);
    background-color: #615458;
    border-radius: 2px;
    box-sizing: border-box;
}

.mini-quadrado.V {
    background-color: #3aa394;
    border-color: #3aa394;
}

.mini-quadrado.A {
    background-color: #d3ad69;
    border-color: #d3ad69;
}

.mini-quadrado.C {
    background-color: #312a2c;
    border-color: #312a2c;
}

.mini-quadrado.digitando {
    border: min(0.2vh, 0.4vw, 1px) solid #312a2c;
    background-color: #615458;
}

/* === TELA DE LOADING === */
#loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: #6e5c62;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 8888;
    opacity: 1;
    visibility: visible;
    transition: opacity 0.4s ease, visibility 0.4s ease;
}

#loading-overlay.esconder {
    opacity: 0;
    visibility: hidden;
}

.loading-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 80%;
    max-width: 300px;
}

.loading-title {
    font-size: min(6vh, 3rem);
    letter-spacing: 2px;
    margin: 0 0 10px 0;
}

.loading-subtitle {
    font-size: min(2.2vh, 1.1rem);
    margin: 0 0 30px 0;
    opacity: 0.9;
}

.loading-bar-bg {
    width: 100%;
    height: 6px;
    background-color: #4c4347;
    border-radius: 4px;
    overflow: hidden;
}

.loading-bar-fill {
    height: 100%;
    background-color: #ffffff;
    border-radius: 4px;
    width: 0%;
    animation: simularCarregamento 6s cubic-bezier(0.2, 0, 0.4, 1) forwards;
}


@keyframes simularCarregamento {

    0% {
        width: 0%;
    }

    100% {
        width: 100%;
    }

}

/* === RESPONSIVIDADE === */
@media (max-width: 600px) {

    header h1 {
        font-size: 1.8rem;
        margin-top: 5px;
    }

    .tecla {
        -webkit-tap-highlight-color: transparent;
        -webkit-user-select: none;
        transition: background-color 0.1s ease;
    }

    .tecla:active {
        background-color: #615458 !important;
        transform: scale(0.95);
        transition: 0s;
    }

    .tecla:focus {
        outline: none;
        background-color: #4c4347;
    }

    .linha-teclado:nth-child(2) {
        padding: 0 4%;
        box-sizing: border-box;
    }

    #painel-multiplayer {
        position: static;
        flex-direction: row;
        height: auto;
        width: 100vw;
        justify-content: flex-start;
        align-items: center;
        margin-top: 2vh;
        margin-bottom: 2vh;
        overflow-x: auto;
        white-space: nowrap;
        box-sizing: border-box;
    }

    #lista-amigos {
        flex-direction: row;
        align-items: center;
    }

    .amigo-container {
        height: max-content;
        padding: 12px 16px;
    }


    #painel-multiplayer::-webkit-scrollbar {
        display: none;
    }
}


@media (max-width: 360px) {

    .tecla {
        font-size: min(2vh, 4vw, 14px);
        padding: 0;
    }

    #ENTER, #⌫ {
        font-size: min(1.8vh, 3vw, 12px);
    }

    #teclado {
        gap: 4px;
        padding: 0 4px;
    }

    .linha-teclado {
        gap: 3px;
    }
}


@media (hover: hover) {

    .tecla:hover {
        background-color: #615458;
    }

    .tecla.ausente:hover {
        background-color: #4c4347 !important;
    }
}