@import url('https://fonts.googleapis.com/css2?family=Dancing+Script:wght@700&family=Poppins:wght@400;600;800&family=Gochi+Hand&display=swap');

:root {
    --postit-yellow: #fff382;
    --postit-blue: #7afaff;
    --postit-pink: #ff7eb9;
    --postit-green: #a7ff83;
    --text: #2d3436;
}

/* FUNDO ESTILIZADO (QUADRICULADO) */
body {
    margin: 0; 
    font-family: 'Poppins', sans-serif;
    background: #e0e0e0;
    background-image: radial-gradient(#bcbcbc 1px, transparent 1px);
    background-size: 20px 20px;
    display: flex; 
    justify-content: center; 
    align-items: center;
    height: 100vh; 
    overflow: hidden;
    transition: background 0.3s ease;
}

/* ACESSIBILIDADE - FONTE GRANDE (FORÇA MÁXIMA) */
body.font-grande, 
body.font-grande button, 
body.font-grande input, 
body.font-grande p, 
body.font-grande div, 
body.font-grande span,
body.font-grande h1,
body.font-grande h2 { 
    font-size: 1.6rem !important; 
}
body.font-grande .game-title { font-size: 4.8rem !important; }
body.font-grande #question { font-size: 3.2rem !important; line-height: 1.1; }
body.font-grande .postit-button { font-size: 2.4rem !important; padding: 20px !important; }

/* ALTO CONTRASTE */
body.high-contrast { background: #000 !important; background-image: none !important; color: #fff !important; }
body.high-contrast .screen { 
    background: #000 !important; 
    border: 4px solid #fff !important; 
    color: #fff !important; 
    box-shadow: none !important;
    transform: none !important; /* Remove rotação para facilitar leitura */
}
body.high-contrast .postit-button { background: #fff !important; color: #000 !important; border: 2px solid #000 !important; }
body.high-contrast .digit-input { border-bottom: 3px solid #fff !important; color: #fff !important; }
body.high-contrast .timer-wrapper { background: #444 !important; }
body.high-contrast #timer-bar { background: #fff !important; }

/* CONTAINER DO POST-IT */
.screen {
    background: var(--postit-yellow);
    padding: 2.5rem;
    width: 520px;
    min-height: 580px;
    position: relative;
    box-shadow: 15px 15px 25px rgba(0,0,0,0.15);
    transform: rotate(1.5deg);
    display: flex;
    flex-direction: column;
    justify-content: center;
    border-bottom-right-radius: 80px 10px; /* Efeito de folha dobrada */
    transition: transform 0.3s ease, background 0.3s ease;
}

.screen::before {
    content: "";
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    width: 120px;
    height: 35px;
    background: rgba(255,255,255,0.4); /* Fita adesiva */
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.hidden { display: none !important; }

/* TÍTULOS */
.game-title {
    font-family: 'Gochi Hand', cursive;
    font-size: 3.8rem;
    color: #333;
    text-align: center;
    margin: 0 0 20px 0;
    transform: rotate(-2deg);
}

.game-title-mini {
    font-family: 'Gochi Hand', cursive;
    font-size: 2.2rem;
    text-align: center;
    margin-bottom: 15px;
}

/* BOTÕES ESTILO POST-IT */
.postit-button {
    font-family: 'Gochi Hand', cursive;
    font-size: 1.8rem;
    background: var(--postit-pink);
    border: none;
    padding: 18px;
    cursor: pointer;
    margin: 12px auto;
    display: block;
    width: 90%;
    color: white;
    box-shadow: 5px 5px 0px rgba(0,0,0,0.1);
    transition: all 0.2s;
}

.postit-button:hover {
    transform: scale(1.03);
    box-shadow: 7px 7px 0px rgba(0,0,0,0.15);
}

.postit-button:active {
    transform: translateY(4px);
    box-shadow: 2px 2px 0px rgba(0,0,0,0.1);
}

/* INPUTS DE RESPOSTA */
.digit-input { 
    width: 50px;
    height: 70px;
    font-size: 2.5rem;
    text-align: center; 
    border: none;
    border-bottom: 3px solid #333;
    background: transparent;
    outline: none;
    font-family: 'Gochi Hand';
    margin: 5px;
    transition: border-color 0.3s;
}

.digit-input:focus { border-bottom-color: var(--postit-pink); }

/* INTERFACE DO JOGO */
.top-info { 
    display: flex; 
    justify-content: space-between; 
    font-family: 'Gochi Hand'; 
    font-size: 1.7rem;
    margin-bottom: 10px;
}

.timer-wrapper { 
    width: 100%; 
    height: 14px; 
    background: rgba(0,0,0,0.08); 
    margin-bottom: 20px; 
    border-radius: 20px; 
    overflow: hidden; 
}

#timer-bar { 
    width: 100%; 
    height: 100%; 
    background: #333; 
    transition: width 0.1s linear; 
}

.badge {
    align-self: center;
    background: var(--postit-blue);
    padding: 5px 15px;
    font-family: 'Gochi Hand';
    font-size: 1.2rem;
    transform: rotate(-1deg);
    margin-bottom: 15px;
    box-shadow: 2px 2px 5px rgba(0,0,0,0.1);
}

#question { 
    font-family: 'Gochi Hand'; 
    font-size: 2rem; 
    margin: 15px 0; 
    text-align: center; 
    min-height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* FOTO E RECORDISTA */
#photo-winner img { 
    width: 200px; 
    height: 160px; 
    border: 8px solid white; 
    background: white; 
    transform: rotate(-4deg);
    box-shadow: 5px 5px 15px rgba(0,0,0,0.2);
    margin-top: 15px;
    object-fit: cover;
}

.highscore-text {
    font-family: 'Gochi Hand';
    font-size: 1.8rem;
    text-align: center;
    margin-top: 20px;
}

/* BARRA DE CARREGAMENTO */
.loader-bar { 
    width: 100%; 
    height: 12px; 
    background: rgba(0,0,0,0.1); 
    border-radius: 10px; 
    margin-top: 10px;
}

#load-progress { 
    width: 0%; 
    height: 100%; 
    background: var(--postit-pink); 
    border-radius: 10px; 
    transition: width 0.1s;
}

/* VÍDEO DA CÂMARA */
#webcam {
    width: 100%;
    max-width: 300px;
    margin: 15px auto;
    border: 5px solid #fff;
    border-radius: 10px;
    display: block;
}


/* --- RESPONSIVIDADE PARA CELULARES --- */

@media (max-width: 600px) {
    .screen {
        width: 90vw; /* Usa 90% da largura da tela */
        min-height: 500px;
        padding: 1.5rem;
        /* Reduz a escala geral para caber em telas muito pequenas */
        transform: rotate(1deg) scale(0.9); 
    }

    .game-title {
        font-size: 2.5rem !important; /* Título menor no celular */
    }

    #question {
        font-size: 1.5rem;
        min-height: 80px;
    }

    .digit-input {
        width: 35px;
        height: 50px;
        font-size: 1.8rem;
    }

    .postit-button {
        font-size: 1.4rem;
        padding: 12px;
    }

    /* Ajuste para a foto do recordista não ocupar a tela toda */
    #photo-winner img {
        width: 140px;
        height: 110px;
    }
}

/* Para celulares muito pequenos (iPhone SE, etc) */
@media (max-width: 380px) {
    .screen {
        transform: rotate(0deg) scale(0.8);
        margin-top: -20px;
    }
}