/* RESET BÁSICO */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* PALETA NATALÍCIA */
:root {
    --bg-grad: radial-gradient(circle at top, #fffae5 0%, #ffd7a0 22%, #b31217 75%, #4a0b0b 100%);
    --card-bg: rgba(255, 255, 255, 0.94);
    --primary: #c62828;
    /* vermelho principal */
    --primary-dark: #8e0000;
    --secondary: #2e7d32;
    /* verde */
    --accent: #ffca28;
    /* dourado */
    --accent-soft: #ffe082;
    --text-main: #2b2b2b;
    --text-soft: #5a5a5a;
    --white: #ffffff;
    --shadow-soft: 0 15px 35px rgba(0, 0, 0, 0.25);
    --radius-card: 26px;
    --radius-pill: 999px;
    --transition-fast: 0.2s ease-out;
    --transition-med: 0.35s ease-out;
}

/* BODY / LAYOUT */
body {
    font-family: 'Montserrat', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--bg-grad);
    min-height: 100vh;
    overflow-x: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 16px;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.96);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Classes de visibilidade das telas */
.screen {
    display: none;
    width: 100%;
}

.screen.active {
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Tela de Boas-Vindas */
#welcome-screen {
    background: transparent;
}

.welcome-content {
    text-align: center;
    padding: 40px 28px;
    background: var(--card-bg);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-soft);
    position: relative;
    overflow: hidden;
}

/* Flocos decorativos */
.welcome-content::before,
.welcome-content::after {
    content: "❄️";
    position: absolute;
    font-size: 80px;
    opacity: 0.15;
}

.welcome-content::before {
    top: -10px;
    left: 10px;
}

.welcome-content::after {
    bottom: -10px;
    right: 10px;
}

.game-title {
    font-size: 3rem;
    font-weight: 900;
    color: var(--primary);
    text-shadow: 0 3px 0 rgba(0, 0, 0, 0.25);
    margin-bottom: 12px;
    letter-spacing: 2px;
}

.game-subtitle {
    font-size: 1.1rem;
    color: var(--text-soft);
    margin-bottom: 32px;
}

/* Input e-mail */
.name-input-container {
    margin-bottom: 28px;
    display: flex;
    justify-content: center;
}

#userEmail {
    width: 100%;
    max-width: 500px;
    padding: 16px 22px;
    font-size: 1.1rem;
    border-radius: var(--radius-pill);
    border: 2px solid rgba(198, 40, 40, 0.35);
    text-align: center;
    font-weight: 600;
    background: #fffdf7;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.12);
    transition: all var(--transition-med);
}

#userEmail::placeholder {
    color: #b0b0b0;
}

/* Botão principal */
.btn-start {
    padding: 16px 52px;
    font-size: 1.25rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: var(--white);
    border-radius: var(--radius-pill);
    cursor: pointer;
    box-shadow: 0 14px 32px rgba(141, 27, 27, 0.5);
    transition: all var(--transition-med);
    text-transform: uppercase;
    letter-spacing: 1px;
    border: none;
}

.btn-start:hover {
    transform: translateY(-3px) scale(1.03);
    box-shadow: 0 18px 40px rgba(141, 27, 27, 0.7);
}

/* Quiz header container */
.quiz-header {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
}

/* Barra de progresso */
.progress-bar {
    width: 100%;
    max-width: 1200px;
    margin: 20px auto 30px auto;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 999px;
    height: 18px;
    overflow: visible;
    box-shadow: inset 0 3px 8px rgba(0, 0, 0, 0.2);
    position: relative;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--secondary) 0%, var(--accent) 100%);
    border-radius: 999px;
    transition: width 0.4s ease-out;
    box-shadow: 0 0 12px rgba(46, 125, 50, 0.9);
    position: relative;
}

/* Pai Natal no trenó - imagem PNG ou emoji fallback */
.progress-fill::after {
    content: "";
    position: absolute;
    right: -70px;
    top: 50%;
    transform: translateY(-50%);
    width: 90px;
    height: 70px;
    background-image: url('imagens/santa_sleigh.png');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    font-size: 45px;
    line-height: 70px;
    text-align: center;
    animation: sleighBounce 0.8s ease-in-out infinite;
    filter: drop-shadow(2px 2px 4px rgba(0, 0, 0, 0.3));
}

@keyframes sleighBounce {

    0%,
    100% {
        transform: translateY(-50%);
    }

    50% {
        transform: translateY(-60%);
    }
}

.question-counter {
    text-align: right;
    font-size: 1rem;
    color: #fffde7;
    font-weight: 700;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    gap: 20px;
    align-items: center;
}

/* Timer */
.timer-container {
    display: flex;
    align-items: center;
    gap: 5px;
    background: rgba(255, 255, 255, 0.9);
    padding: 8px 16px;
    border-radius: 20px;
    color: var(--primary);
    font-weight: 800;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

#userEmail:focus {
    outline: none;
    transform: scale(1.03);
    border-color: var(--primary);
    box-shadow: 0 10px 30px rgba(198, 40, 40, 0.35);
}


@keyframes sleighBounce {

    0%,
    100% {
        transform: translateY(-50%);
    }

    50% {
        transform: translateY(-60%);
    }
}

.question-counter {
    text-align: right;
    font-size: 1rem;
    color: #fffde7;
    font-weight: 700;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    gap: 20px;
    align-items: center;
}

/* Timer */
.timer-container {
    display: flex;
    align-items: center;
    gap: 5px;
    background: rgba(255, 255, 255, 0.9);
    padding: 8px 16px;
    border-radius: 20px;
    color: var(--primary);
    font-weight: 800;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* ALSO FIX #userEmail:focus - Replace lines 140-147 with this: */

#userEmail:focus {
    outline: none;
    transform: scale(1.03);
    border-color: var(--primary);
    box-shadow: 0 10px 30px rgba(198, 40, 40, 0.35);
}

.timer-icon {
    font-size: 1.2rem;
    animation: tickTock 1s infinite;
}

.timer {
    font-size: 1.3rem;
    min-width: 30px;
    text-align: center;
}

.timer.warning {
    color: #ff5722;
    animation: timerPulse 0.5s infinite;
}

@keyframes tickTock {

    0%,
    100% {
        transform: rotate(0deg);
    }

    25% {
        transform: rotate(-10deg);
    }

    75% {
        transform: rotate(10deg);
    }
}

@keyframes timerPulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
    }
}

/* Caixa da pergunta */
.question-container {
    width: 100%;
    max-width: 960px;
    margin: 0 auto;
    animation: questionSlide 0.4s ease-out;
}

@keyframes questionSlide {
    from {
        opacity: 0;
        transform: translateY(12px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.question-image-container {
    text-align: center;
    margin-bottom: 20px;
    max-width: 700px;
    margin-left: auto;
    margin-right: auto;
}

.question-image {
    max-width: 100%;
    width: auto;
    max-height: 280px;
    border-radius: 15px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    object-fit: contain;
    display: block;
    margin: 0 auto;
}

.question-title {
    background: var(--card-bg);
    padding: 28px 24px;
    border-radius: var(--radius-card);
    font-size: 1.5rem;
    font-weight: 700;
    text-align: center;
    color: var(--primary-dark);
    margin-bottom: 22px;
    box-shadow: var(--shadow-soft);
    line-height: 1.4;
    position: relative;
}

.question-title::after {
    content: "🎅";
    position: absolute;
    right: 16px;
    bottom: 10px;
    font-size: 26px;
    opacity: 0.4;
}

/* Grelha de respostas */
.answers-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin-bottom: 10px;
}

/* Botões de resposta – cores natalícias */
.answer-btn {
    padding: 20px 18px;
    font-size: 1.05rem;
    font-weight: 700;
    border-radius: 18px;
    cursor: pointer;
    transition: all var(--transition-med);
    color: var(--white);
    text-align: center;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.28);
    position: relative;
    border: none;
    line-height: 1.3;
}

.answer-btn::before {
    content: "🎁";
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.2rem;
}

/* 4 cores para as 4 opções, todas com vibe natalícia */
.answer-btn:nth-child(1) {
    background: linear-gradient(135deg, #b71c1c, #f44336);
}

.answer-btn:nth-child(2) {
    background: linear-gradient(135deg, #1b5e20, #4caf50);
}

.answer-btn:nth-child(3) {
    background: linear-gradient(135deg, #f9a825, #ffca28);
    color: #4e342e;
}

.answer-btn:nth-child(4) {
    background: linear-gradient(135deg, #283593, #5c6bc0);
}

.answer-btn:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 14px 32px rgba(0, 0, 0, 0.35);
    filter: brightness(1.04);
}

.answer-btn:active {
    transform: translateY(-1px) scale(1.01);
}

/* efeito ao clicar (já usado no JS) */
.answer-btn.selected {
    transform: scale(0.95);
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.3);
}

.answer-btn.correct {
    background: linear-gradient(135deg, #26890c 0%, #1e6a08 100%) !important;
    animation: pulseCorrect 0.5s ease-out;
}

.answer-btn.incorrect {
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%) !important;
    animation: shake 0.5s ease-out;
}

.answer-btn.disabled {
    pointer-events: none;
    opacity: 0.6;
}

@keyframes pulseCorrect {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }
}

@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-10px);
    }

    75% {
        transform: translateX(10px);
    }
}

.explanation-box {
    margin-top: 30px;
    padding: 25px;
    border-radius: 15px;
    animation: slideDown 0.4s ease-out;
}

.explanation-box.correct {
    background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%);
    border: 3px solid #28a745;
}

.explanation-box.incorrect {
    background: linear-gradient(135deg, #f8d7da 0%, #f5c6cb 100%);
    border: 3px solid #dc3545;
}

.explanation-icon {
    font-size: 3em;
    margin-bottom: 15px;
    text-align: center;
}

.explanation-box p {
    font-size: 1.2em;
    color: #2c3e50;
    font-weight: 600;
    line-height: 1.6;
    text-align: center;
    margin: 0;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.btn-next {
    width: 100%;
    margin-top: 20px;
    padding: 20px;
    font-size: 1.3em;
    font-weight: 800;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 15px;
    cursor: pointer;
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
    transition: all 0.3s;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.btn-next:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.6);
}

.btn-next:active {
    transform: translateY(-1px);
}

/* ESTADO CORRETO/ERRADO (se quiseres usar mais tarde no JS) */
.answer-btn.correct {
    background: linear-gradient(135deg, var(--secondary), #66bb6a) !important;
    color: #f1f8e9;
}

.answer-btn.wrong {
    background: linear-gradient(135deg, var(--primary), #ef5350) !important;
}

/* TELA DE RESULTADO */
#result-screen {
    background: transparent;
}

.result-content {
    text-align: center;
    padding: 36px 26px;
    background: var(--card-bg);
    border-radius: 30px;
    box-shadow: var(--shadow-soft);
    max-width: 620px;
    animation: bounceIn 0.6s ease-out;
    margin: 0 auto;
    position: relative;
    overflow: hidden;
}

.result-content::before,
.result-content::after {
    content: "❄️";
    position: absolute;
    font-size: 70px;
    opacity: 0.12;
}

.result-content::before {
    top: -8px;
    right: 8px;
}

.result-content::after {
    bottom: -10px;
    left: 12px;
}

@keyframes bounceIn {
    0% {
        opacity: 0;
        transform: scale(0.8);
    }

    60% {
        transform: scale(1.05);
    }

    100% {
        opacity: 1;
        transform: scale(1);
    }
}

.result-icon {
    font-size: 4rem;
    margin-bottom: 12px;
}

.result-title {
    font-size: 2.1rem;
    color: var(--primary);
    margin-bottom: 18px;
    font-weight: 800;
}

.score-display {
    margin-bottom: 12px;
}

.score-number {
    font-size: 3.2rem;
    font-weight: 900;
    background: linear-gradient(135deg, var(--secondary), var(--primary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.score-label {
    font-size: 1rem;
    color: var(--text-soft);
    font-weight: 600;
}

.percentage {
    font-size: 2.1rem;
    font-weight: 800;
    color: var(--accent);
    margin: 4px 0 10px 0;
}

.result-message {
    font-size: 1.1rem;
    color: var(--text-main);
    margin-bottom: 20px;
    font-weight: 600;
}

/* Botões de resultado */
.result-buttons {
    display: flex;
    justify-content: center;
    margin-top: 10px;
}

.btn-submit-results {
    padding: 14px 34px;
    font-size: 1.05rem;
    font-weight: 800;
    border-radius: var(--radius-pill);
    cursor: pointer;
    transition: all var(--transition-med);
    color: var(--white);
    background: linear-gradient(135deg, var(--secondary), var(--primary));
    box-shadow: 0 12px 30px rgba(46, 125, 50, 0.5);
    border: none;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.btn-submit-results:hover {
    transform: translateY(-3px) scale(1.03);
    box-shadow: 0 15px 38px rgba(46, 125, 50, 0.65);
    filter: brightness(1.04);
}

.btn-submit-results:active {
    transform: translateY(-1px) scale(1.01);
}

.btn-submit-results:disabled {
    background: #b0bec5;
    box-shadow: none;
    cursor: not-allowed;
}

/* Mensagem de sucesso */
.success-message {
    margin-top: 18px;
    padding: 18px 16px;
    background: #e8f5e9;
    border: 2px solid #2e7d32;
    border-radius: 18px;
    animation: successPulse 0.5s ease-out;
}

@keyframes successPulse {
    0% {
        transform: scale(0.92);
        opacity: 0;
    }

    60% {
        transform: scale(1.04);
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.success-icon {
    font-size: 2.2rem;
    margin-bottom: 6px;
}

.success-message p {
    font-size: 1rem;
    color: #1b5e20;
    font-weight: 700;
    margin: 0;
}

.email-info {
    font-size: 0.95rem;
    color: #666;
    margin-top: 10px;
}

.email-info span {
    font-weight: 700;
    color: var(--primary);
}

/* Efeito de neve */
.snow {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    background-image:
        radial-gradient(2px 2px at 20px 30px, white, transparent),
        radial-gradient(2px 2px at 40px 70px, white, transparent),
        radial-gradient(1px 1px at 90px 40px, white, transparent),
        radial-gradient(2px 2px at 160px 120px, white, transparent),
        radial-gradient(1px 1px at 300px 100px, white, transparent),
        radial-gradient(2px 2px at 400px 60px, white, transparent);
    background-size: 450px 450px;
    animation: snowfall 20s linear infinite;
}

@keyframes snowfall {
    from {
        background-position: 0 0;
    }

    to {
        background-position: 0 450px;
    }
}

/* Decorações de Natal */
.christmas-decoration {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    pointer-events: none;
}

.ornament {
    position: absolute;
    font-size: 3em;
    animation: float 3s ease-in-out infinite;
}

.ornament-1 {
    top: 10%;
    left: 10%;
    animation-delay: 0s;
}

.ornament-2 {
    top: 20%;
    right: 10%;
    animation-delay: 0.5s;
}

.ornament-3 {
    bottom: 20%;
    left: 15%;
    animation-delay: 1s;
}

.ornament-4 {
    bottom: 15%;
    right: 15%;
    animation-delay: 1.5s;
}

.ornament-5 {
    top: 50%;
    right: 5%;
    animation-delay: 2s;
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0px) rotate(0deg);
    }

    50% {
        transform: translateY(-20px) rotate(10deg);
        display: block;
    }
}

/* RESPONSIVO */
@media (max-width: 768px) {
    .game-title {
        font-size: 2.3rem;
    }

    .welcome-content,
    .result-content {
        padding: 26px 18px;
    }

    .question-title {
        font-size: 1.25rem;
        padding: 22px 16px;
    }

    .answers-grid {
        grid-template-columns: 1fr;
    }

    .answer-btn {
        padding: 18px 16px;
        font-size: 1rem;
    }

    .result-title {
        font-size: 1.7rem;
    }

    .score-number {
        font-size: 2.7rem;
    }
}