/* --- 1. VARIÁVEIS E DESIGN SYSTEM --- */
:root {
    /* Cores */
    --primary: #4f46e5;       /* Roxo Índigo */
    --primary-dark: #4338ca;
    --primary-light: #eef2ff;
    
    --success: #10b981;       /* Verde */
    --success-light: #dcfce7;
    --error: #ef4444;         /* Vermelho */
    --error-light: #fee2e2;
    
    --bg-app: #f8fafc;        /* Fundo Geral */
    --surface: #ffffff;       /* Fundo Cards */
    --text-main: #1e293b;
    --text-secondary: #64748b;
    
    /* Sombras e Bordas */
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1);
    --radius: 16px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-app);
    color: var(--text-main);
    margin: 0;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    padding: 20px;
}

#app {
    width: 100%;
    max-width: 500px;
    padding-bottom: 40px;
    animation: fadeIn 0.4s ease-out;
}

/* Tipografia */
h1, h2, h3 { font-family: 'Poppins', sans-serif; margin: 0; line-height: 1.2; }
h1 { font-size: 1.8rem; font-weight: 700; letter-spacing: -0.5px; }
h2 { font-size: 1.4rem; font-weight: 600; color: var(--text-main); }

/* --- TELA INICIAL --- */
#tela-inicial { text-align: center; padding-top: 30px; }
.logo-area { margin-bottom: 40px; }
.logo-area h1 {
    font-size: 2.5rem;
    background: linear-gradient(135deg, var(--primary) 0%, #818cf8 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 8px;
}
.logo-area p { font-size: 1.1rem; color: var(--text-secondary); margin: 0; }

/* Botões Menu */
.btn-menu {
    border: none; padding: 20px 24px; width: 100%;
    border-radius: var(--radius); margin-bottom: 16px;
    text-align: left; display: flex; flex-direction: column;
    cursor: pointer; position: relative; overflow: hidden;
    transition: all 0.2s ease;
}
.btn-menu:active { transform: scale(0.98); }

.btn-menu span {
    font-family: 'Poppins', sans-serif; font-weight: 600; font-size: 1.1rem;
    display: flex; align-items: center; gap: 10px;
}

/* Botão Azul Grande (Simulado) */
.btn-menu.grande {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white; box-shadow: 0 8px 20px -5px rgba(79, 70, 229, 0.4);
    padding: 28px 24px;
}
.btn-menu.grande small { color: rgba(255,255,255, 0.8); margin-top: 6px; font-size: 0.9rem;}
.btn-menu.grande::after { content: '→'; position: absolute; right: 24px; top: 50%; transform: translateY(-50%); font-size: 1.5rem; opacity: 0.7; color: white;}

/* Botão Roxo (Desafio) */
.btn-menu.destaque-roxo {
    background: linear-gradient(135deg, #7c3aed 0%, #a78bfa 100%);
    color: white; box-shadow: 0 8px 20px -5px rgba(124, 58, 237, 0.4);
}
.btn-menu.destaque-roxo small { color: rgba(255,255,255, 0.8); margin-top: 4px; font-size: 0.9rem;}
.btn-menu.destaque-roxo::after { content: '🏆'; position: absolute; right: 24px; top: 50%; transform: translateY(-50%); font-size: 1.5rem; opacity: 0.8;}

/* Botões Brancos (Padrão) */
.btn-menu:not(.grande):not(.destaque-roxo) {
    background: var(--surface); color: var(--text-main);
    box-shadow: var(--shadow-sm); border: 1px solid transparent;
}
.btn-menu:not(.grande):not(.destaque-roxo) span { color: var(--primary); }
.btn-menu:not(.grande):not(.destaque-roxo):hover {
    background: var(--primary-light); transform: translateY(-2px); box-shadow: var(--shadow-md);
}
.btn-menu:not(.grande):not(.destaque-roxo)::after {
    content: '→'; position: absolute; right: 24px; top: 50%; transform: translateY(-50%);
    font-size: 1.4rem; opacity: 0.4; color: var(--text-secondary); transition: 0.2s;
}

/* --- NAVEGAÇÃO INTERNA --- */
.cabecalho-interno {
    display: flex; align-items: center; gap: 15px;
    margin-bottom: 30px; padding-top: 10px;
}
.btn-voltar {
    background: var(--surface); height: 44px; padding: 0 20px 0 15px;
    border-radius: 50px; border: 1px solid #e2e8f0;
    color: var(--text-main); cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    font-family: 'Poppins', sans-serif; font-weight: 600; font-size: 0.95rem;
    box-shadow: var(--shadow-sm); transition: 0.2s;
}
.btn-voltar:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }

/* --- CARD BRIEFING (ONBOARDING) --- */
.card-briefing {
    background: var(--surface); border-radius: 24px;
    padding: 40px 30px; text-align: center;
    box-shadow: var(--shadow-lg); animation: slideUp 0.4s ease-out; margin-top: 10px;
}
#briefing-icon {
    font-size: 4rem; margin-bottom: 20px;
    background: var(--primary-light); width: 100px; height: 100px;
    line-height: 100px; border-radius: 50%; margin-left: auto; margin-right: auto;
}
#briefing-titulo { color: var(--primary); margin-bottom: 15px; }
#briefing-desc { font-size: 1.1rem; color: var(--text-secondary); line-height: 1.6; margin-bottom: 30px; }
.briefing-meta {
    display: flex; justify-content: center; gap: 10px;
    color: var(--text-secondary); font-weight: 600; font-size: 0.9rem;
    margin-bottom: 40px; background: #f1f5f9; padding: 10px;
    border-radius: 50px; width: fit-content; margin-left: auto; margin-right: auto;
}

/* --- SETUP DESAFIO --- */
.setup-container {
    background: var(--surface); padding: 30px 20px;
    border-radius: 24px; box-shadow: var(--shadow-md); animation: slideUp 0.4s ease-out;
}
.setup-group { margin-bottom: 30px; }
.setup-group label { display: block; font-weight: 700; margin-bottom: 12px; color: var(--text-main); }

.input-select {
    width: 100%; padding: 16px; border-radius: 12px; border: 2px solid #e2e8f0;
    font-size: 1rem; font-family: 'Inter', sans-serif; background: white; appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat; background-position: right 15px center; background-size: 18px;
}

.chips-container { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.chip-option {
    background: #f1f5f9; border: 2px solid transparent; border-radius: 12px;
    padding: 12px 5px; font-size: 0.9rem; font-weight: 600; color: var(--text-secondary);
    cursor: pointer; transition: 0.2s;
}
.chip-option:hover { background: #e2e8f0; }
.chip-option.selected {
    background: var(--primary-light); border-color: var(--primary);
    color: var(--primary); box-shadow: var(--shadow-sm);
}

/* --- QUIZ --- */
.topo-info {
    display: flex; justify-content: space-between; align-items: center;
    background: var(--surface); padding: 10px 15px; border-radius: 50px;
    box-shadow: var(--shadow-sm); margin-bottom: 25px;
}
#timer {
    font-family: 'Inter', monospace; font-weight: 700;
    background: #f1f5f9; padding: 6px 12px; border-radius: 20px;
}
#timer.perigo { background: var(--error-light); color: var(--error); animation: pulse 1s infinite; }
#btn-sair-quiz {
    background: var(--error-light); color: var(--error); font-weight: 600;
    padding: 6px 12px; border-radius: 20px; border: none; cursor: pointer;
}
#progresso { text-align: center; color: var(--text-secondary); font-weight: 600; margin-bottom: 20px; text-transform: uppercase; font-size: 0.85rem; letter-spacing: 1px;}

#categoria-tag {
    display: inline-block; background: var(--primary-light); color: var(--primary);
    padding: 6px 12px; border-radius: 20px; font-size: 0.75rem; font-weight: 700;
    text-transform: uppercase; margin-bottom: 15px;
}
#pergunta { font-size: 1.3rem; margin-bottom: 30px; }
/* Imagem da questão (Ajustada para ficar menor) */
#imagem-quiz {
    max-width: 100%;       /* Garante que não ultrapasse a largura da tela no celular */
    max-height: 180px;     /* LIMITA A ALTURA: Aqui está o segredo (pode testar 150px ou 200px) */
    width: auto;           /* Mantém a proporção correta (não estica) */
    display: block;        /* Permite centralizar com margin auto */
    margin: 0 auto 25px;   /* 0 em cima, auto nas laterais (centraliza), 25px em baixo */
    
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    border: 1px solid #e2e8f0;
}

.botao-opcao {
    width: 100%; padding: 18px 20px; margin-bottom: 12px;
    background: var(--surface); border: 2px solid transparent; border-radius: 16px;
    font-size: 1rem; color: var(--text-main); font-family: 'Inter', sans-serif;
    text-align: left; cursor: pointer; box-shadow: var(--shadow-sm); transition: 0.2s; position: relative;
}
.botao-opcao:hover:not(:disabled) { border-color: var(--primary); background: var(--primary-light); }
.botao-opcao.correto { background: var(--success-light) !important; border-color: var(--success) !important; color: #064e3b; font-weight: 600; }
.botao-opcao.correto::after { content: '✓'; position: absolute; right: 20px; font-weight: bold; }
.botao-opcao.errado { background: var(--error-light) !important; border-color: var(--error) !important; color: #7f1d1d; font-weight: 600;}
.botao-opcao.errado::after { content: '✕'; position: absolute; right: 20px; font-weight: bold; }

#feedback { margin-top: 30px; background: var(--surface); padding: 25px; border-radius: var(--radius); box-shadow: var(--shadow-lg); border-left: 6px solid var(--primary); animation: fadeIn 0.3s; }
#btn-proxima { background: var(--primary); color: white; width: 100%; padding: 16px; border: none; border-radius: 12px; font-size: 1.1rem; font-weight: 600; cursor: pointer; margin-top: 20px; box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3); }

/* --- LISTAS (Temas/Histórico) --- */
.btn-tema-escolha {
    width: 100%; background: var(--surface); padding: 20px; margin-bottom: 12px;
    border: none; border-radius: 16px; display: flex; justify-content: space-between; align-items: center;
    cursor: pointer; box-shadow: var(--shadow-sm); transition: 0.2s;
}
.btn-tema-escolha span { font-size: 1rem; font-weight: 600; color: var(--text-main); font-family: 'Poppins', sans-serif;}
.btn-tema-escolha small { background: var(--primary-light); color: var(--primary); padding: 5px 10px; border-radius: 20px; font-size: 0.8rem; font-weight: 600;}
.btn-tema-escolha:hover { transform: translateX(5px); background: var(--primary-light); }

.item-historico {
    background: var(--surface); padding: 20px; border-radius: 18px; margin-bottom: 14px;
    box-shadow: var(--shadow-sm); display: flex; justify-content: space-between; align-items: center;
    position: relative; overflow: hidden;
}
.item-historico::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 6px; }
.item-historico.aprovado::before { background: var(--success); }
.item-historico.reprovado::before { background: var(--error); }
.nota-historico { font-family: 'Poppins', sans-serif; font-size: 1.5rem; font-weight: 700; color: var(--text-main); }
.data-historico { font-size: 0.8rem; color: var(--text-secondary); }
.icone-status { font-size: 2rem; }

/* --- TELA RESULTADO --- */
#tela-resultado { text-align: center; padding-top: 40px; }
.placar {
    width: 160px; height: 160px; background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    border-radius: 50%; margin: 30px auto; display: flex; flex-direction: column; justify-content: center; align-items: center;
    color: white; box-shadow: 0 15px 35px rgba(79, 70, 229, 0.4);
}
#pontuacao-final { font-size: 3.5rem; font-weight: 700; line-height: 1; font-family: 'Poppins', sans-serif;}
#mensagem-final { font-size: 1.5rem; font-family: 'Poppins', sans-serif; font-weight: 600; margin-bottom: 40px; }
#btn-reiniciar { background: var(--text-main); color: white; width: 100%; padding: 18px; border: none; border-radius: 16px; font-size: 1.1rem; font-weight: 600; cursor: pointer; }

/* Utils */
.oculto { display: none !important; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes pulse { 0% { transform: scale(1); } 50% { transform: scale(1.05); } 100% { transform: scale(1); } }

/* Botão Compartilhar */
.botao-share {
    background: #eef2ff; /* Fundo claro */
    color: var(--primary);
    border: 2px solid var(--primary);
    width: 100%;
    padding: 16px;
    border-radius: 16px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    margin-bottom: 15px; /* Espaço para o botão de baixo */
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    transition: 0.2s;
}

.botao-share:hover {
    background: var(--primary);
    color: white;
}
/* Conteúdo de Texto (Privacidade) */
.conteudo-texto {
    background: var(--surface);
    padding: 25px;
    border-radius: 24px;
    box-shadow: var(--shadow-sm);
    text-align: left;
    line-height: 1.6;
    color: var(--text-secondary);
    
    /* Permite rolar se o texto for grande */
    max-height: 70vh;
    overflow-y: auto;
}

.conteudo-texto h3 {
    color: var(--primary);
    margin-top: 20px;
    margin-bottom: 10px;
    font-size: 1.1rem;
}

.conteudo-texto h3:first-child {
    margin-top: 0;
}
/* --- TELA DE DETALHES DO HISTÓRICO --- */

.resumo-revisao {
    text-align: center;
    margin-bottom: 25px;
    background: white;
    padding: 20px;
    border-radius: 20px;
    box-shadow: var(--shadow-sm);
}

#detalhe-titulo {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 5px;
}

#detalhe-nota {
    font-size: 2.5rem;
    font-weight: 800;
}

/* Lista de Erros */
#lista-erros-detalhe {
    display: flex;
    flex-direction: column;
    gap: 15px;
    max-height: 50vh;
    overflow-y: auto;
    padding-bottom: 20px;
}

.item-erro-card {
    background: white;
    padding: 15px;
    border-radius: 16px;
    border-left: 4px solid #ef4444; /* Tarja vermelha */
    box-shadow: var(--shadow-sm);
    font-size: 0.9rem;
    text-align: left;
}

.item-erro-card p {
    margin: 8px 0;
    font-weight: 500;
    color: var(--text-primary);
}

.resposta-correta {
    background: #ecfdf5;
    color: #047857;
    padding: 8px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    margin-top: 10px;
}

/* Card de Histórico (Menu) - Deixar clicável */
.item-historico {
    transition: transform 0.2s;
}
.item-historico:active {
    transform: scale(0.98);
}