/* ===== RESET E VARIÁVEIS ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Cores principais - MESMAS DO APP */
    --primary: #e65100;
    --primary-light: #ff9800;
    --primary-dark: #bf360c;
    --secondary: #1a237e;
    --accent: #c62828;
    
    /* Cores de feedback */
    --success: #4caf50;
    --success-light: #81c784;
    --error: #f44336;
    --error-light: #e57373;
    
    /* Cores de fundo */
    --bg-primary: #f8f9fa;
    --bg-secondary: #ffffff;
    --bg-card: #ffffff;
    
    /* Cores de texto */
    --text-primary: #1a1a2e;
    --text-secondary: #6b7280;
    --text-light: #9ca3af;
    
    /* Gradientes */
    --gradient: linear-gradient(135deg, var(--primary), var(--primary-light));
    --gradient-success: linear-gradient(135deg, #4caf50, #81c784);
    --gradient-error: linear-gradient(135deg, #f44336, #e57373);
    
    /* Sombras */
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.12);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.16);
    --shadow-primary: 0 4px 16px rgba(230, 81, 0, 0.3);
    
    /* Bordas */
    --radius-sm: 12px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --radius-full: 50px;
    
    /* Transições */
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    
    /* Safe areas */
    --safe-top: env(safe-area-inset-top);
    --safe-bottom: env(safe-area-inset-bottom);
}

/* Tema Escuro */
[data-theme="dark"] {
    --bg-primary: #0f0f1a;
    --bg-secondary: #1a1a2e;
    --bg-card: #252540;
    --text-primary: #ffffff;
    --text-secondary: #a0a0b0;
    --text-light: #6b6b7b;
}

body {
    font-family: 'Poppins', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* ===== TELAS ===== */
.tela {
    display: none;
    min-height: 100vh;
}

.tela.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* ===== HEADER ===== */
.header-jogo {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    padding-top: calc(16px + var(--safe-top));
    background: var(--gradient);
    color: white;
}

.header-jogo h1 {
    font-size: 1.2rem;
    font-weight: 600;
}

.btn-voltar-app {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: rgba(255,255,255,0.2);
    color: white;
    font-size: 1rem;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

.btn-voltar-app:active {
    transform: scale(0.9);
    background: rgba(255,255,255,0.3);
}

.header-spacer {
    width: 40px;
}

/* ===== CONTAINER ===== */
.container {
    padding: 24px 20px;
    padding-bottom: calc(24px + var(--safe-bottom));
}

/* ===== TELA INICIAL ===== */
.jogo-hero {
    text-align: center;
    padding: 40px 20px;
}

.jogo-icon {
    width: 100px;
    height: 100px;
    background: var(--gradient);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    box-shadow: var(--shadow-primary);
}

.jogo-icon i {
    font-size: 2.5rem;
    color: white;
}

.jogo-hero h2 {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.jogo-hero p {
    color: var(--text-secondary);
    font-size: 1rem;
}

/* Recorde Card */
.recorde-card {
    display: flex;
    align-items: center;
    gap: 16px;
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 16px 20px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-sm);
    border-left: 4px solid var(--primary);
}

.recorde-icon {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, #ffd700, #ffb300);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.3rem;
}

.recorde-info {
    display: flex;
    flex-direction: column;
}

.recorde-info span {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.recorde-info strong {
    font-size: 1.3rem;
    color: var(--primary);
    font-weight: 700;
}

/* Botão Jogar */
.btn-jogar {
    width: 100%;
    padding: 18px 32px;
    background: var(--gradient);
    border: none;
    border-radius: var(--radius-full);
    color: white;
    font-size: 1.2rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    box-shadow: var(--shadow-primary);
    transition: var(--transition);
    margin-bottom: 24px;
}

.btn-jogar:active {
    transform: scale(0.98);
}

.btn-jogar i {
    font-size: 1.3rem;
}

/* Stats Resumo */
.stats-resumo {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.stat-item {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 16px;
    text-align: center;
    box-shadow: var(--shadow-sm);
}

.stat-item i {
    font-size: 1.5rem;
    color: var(--primary);
    margin-bottom: 8px;
}

.stat-item span {
    display: block;
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text-primary);
}

.stat-item small {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* ===== TELA CONFIGURAÇÃO ===== */
.config-section {
    margin-bottom: 28px;
}

.config-section h3 {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 14px;
}

.config-section h3 i {
    color: var(--primary);
}

/* ===== GRID DE CATEGORIAS - NOVO LAYOUT COMPACTO ===== */
.opcoes-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    max-height: 320px;
    overflow-y: auto;
    padding-right: 5px;
}

/* Scroll suave e bonito */
.opcoes-grid::-webkit-scrollbar {
    width: 4px;
}

.opcoes-grid::-webkit-scrollbar-track {
    background: var(--bg-primary);
    border-radius: 4px;
}

.opcoes-grid::-webkit-scrollbar-thumb {
    background: var(--primary-light);
    border-radius: 4px;
}

/* Card de Categoria - LAYOUT HORIZONTAL */
.categoria-card {
    background: var(--bg-card);
    border: 2px solid transparent;
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
    
    /* Layout horizontal */
    display: flex;
    align-items: center;
    gap: 10px;
    text-align: left;
}

.categoria-card:active {
    transform: scale(0.98);
}

.categoria-card.active {
    border-color: var(--primary);
    background: rgba(230, 81, 0, 0.1);
}

/* Ícone menor e à esquerda */
.categoria-card i {
    font-size: 1.3rem;
    min-width: 24px;
    text-align: center;
}

/* Texto da categoria */
.categoria-card span {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.2;
}

/* Opções em Linha */
.opcoes-linha {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.opcao-btn {
    flex: 1;
    min-width: 70px;
    padding: 12px 16px;
    background: var(--bg-card);
    border: 2px solid transparent;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    cursor: pointer;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
}

.opcao-btn:active {
    transform: scale(0.98);
}

.opcao-btn.active {
    border-color: var(--primary);
    background: var(--primary);
    color: white;
}

/* Botão Iniciar */
.btn-iniciar {
    width: 100%;
    padding: 18px 32px;
    background: var(--gradient);
    border: none;
    border-radius: var(--radius-full);
    color: white;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    box-shadow: var(--shadow-primary);
    transition: var(--transition);
    margin-top: 20px;
}

.btn-iniciar:active {
    transform: scale(0.98);
}

/* ===== TELA DO JOGO ===== */
.jogo-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    padding-top: calc(16px + var(--safe-top));
    background: var(--bg-secondary);
    box-shadow: var(--shadow-sm);
}

.jogo-progresso,
.jogo-tempo,
.jogo-pontos {
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 600;
    font-size: 1rem;
}

.jogo-progresso {
    color: var(--text-secondary);
}

.jogo-tempo {
    color: var(--primary);
}

.jogo-tempo i {
    font-size: 0.9rem;
}

.jogo-pontos {
    color: #ffc107;
}

.jogo-pontos i {
    font-size: 0.9rem;
}

/* Barra de Progresso */
.barra-progresso {
    height: 4px;
    background: var(--bg-primary);
}

.barra-fill {
    height: 100%;
    background: var(--gradient);
    transition: width 0.3s ease;
    width: 0%;
}

/* Barra de Tempo */
.barra-tempo {
    height: 6px;
    background: var(--bg-primary);
}

.tempo-fill {
    height: 100%;
    background: var(--primary);
    transition: width 0.1s linear;
    width: 100%;
}

.tempo-fill.warning {
    background: #ff9800;
}

.tempo-fill.danger {
    background: var(--error);
    animation: pulse-danger 0.5s infinite;
}

@keyframes pulse-danger {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* Container da Pergunta */
.pergunta-container {
    padding: 24px 20px;
}

.categoria-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-card);
    padding: 8px 16px;
    border-radius: var(--radius-full);
    font-size: 0.85rem;
    color: var(--primary);
    font-weight: 600;
    margin-bottom: 20px;
    box-shadow: var(--shadow-sm);
}

.categoria-badge i {
    font-size: 0.8rem;
}

.pergunta-texto {
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.5;
    margin-bottom: 28px;
}

/* Opções de Resposta */
.opcoes-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.opcao-resposta {
    display: flex;
    align-items: center;
    gap: 14px;
    background: var(--bg-card);
    border: 2px solid var(--bg-primary);
    border-radius: var(--radius-md);
    padding: 16px 20px;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
}

.opcao-resposta:active {
    transform: scale(0.98);
}

.opcao-resposta:hover {
    border-color: var(--primary-light);
}

.opcao-resposta.selected {
    border-color: var(--primary);
    background: rgba(230, 81, 0, 0.1);
}

.opcao-resposta.correct {
    border-color: var(--success);
    background: rgba(76, 175, 80, 0.15);
}

.opcao-resposta.wrong {
    border-color: var(--error);
    background: rgba(244, 67, 54, 0.15);
}

.opcao-resposta.disabled {
    pointer-events: none;
    opacity: 0.7;
}

.opcao-letra {
    width: 36px;
    height: 36px;
    background: var(--bg-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1rem;
    color: var(--text-secondary);
    transition: var(--transition);
}

.opcao-resposta.selected .opcao-letra {
    background: var(--primary);
    color: white;
}

.opcao-resposta.correct .opcao-letra {
    background: var(--success);
    color: white;
}

.opcao-resposta.wrong .opcao-letra {
    background: var(--error);
    color: white;
}

.opcao-texto {
    flex: 1;
    font-size: 1rem;
    color: var(--text-primary);
}

/* Indicador de Sequência */
.sequencia-container {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-card);
    padding: 10px 20px;
    border-radius: var(--radius-full);
    box-shadow: var(--shadow-md);
    opacity: 0;
    transition: var(--transition);
}

.sequencia-container.show {
    opacity: 1;
}

.sequencia-icon {
    font-size: 1.2rem;
}

#sequenciaTexto {
    font-weight: 600;
    color: var(--primary);
}

/* ===== TELA FEEDBACK ===== */
.feedback-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 100;
}

.feedback-card {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    padding: 32px 24px;
    text-align: center;
    max-width: 340px;
    width: 100%;
    animation: scaleIn 0.3s ease;
}

@keyframes scaleIn {
    from {
        transform: scale(0.8);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

.feedback-icon {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    font-size: 2.5rem;
    color: white;
}

.feedback-icon.success {
    background: var(--gradient-success);
}

.feedback-icon.error {
    background: var(--gradient-error);
}

.feedback-card h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.feedback-card h2.success {
    color: var(--success);
}

.feedback-card h2.error {
    color: var(--error);
}

.feedback-card p {
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.feedback-pontos {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 16px;
}

.feedback-referencia {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-primary);
    padding: 10px 20px;
    border-radius: var(--radius-full);
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 24px;
}

.feedback-referencia i {
    color: var(--primary);
}

.btn-proxima {
    width: 100%;
    padding: 16px;
    background: var(--gradient);
    border: none;
    border-radius: var(--radius-full);
    color: white;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: var(--transition);
}

.btn-proxima:active {
    transform: scale(0.98);
}

/* ===== TELA RESULTADO ===== */
.resultado-container {
    min-height: 100vh;
    padding: 40px 20px;
    padding-top: calc(40px + var(--safe-top));
    padding-bottom: calc(40px + var(--safe-bottom));
}

.resultado-header {
    text-align: center;
    margin-bottom: 32px;
}

.resultado-icon {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    font-size: 3rem;
    color: white;
}

.resultado-icon.otimo {
    background: linear-gradient(135deg, #ffd700, #ffb300);
}

.resultado-icon.bom {
    background: var(--gradient-success);
}

.resultado-icon.regular {
    background: linear-gradient(135deg, #ff9800, #f57c00);
}

.resultado-icon.ruim {
    background: var(--gradient-error);
}

.resultado-header h1 {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.resultado-header p {
    color: var(--text-secondary);
}

/* Pontuação */
.resultado-pontuacao {
    text-align: center;
    margin-bottom: 32px;
}

.pontuacao-total {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-md);
}

.pontuacao-total span {
    display: block;
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.pontuacao-total strong {
    font-size: 3rem;
    font-weight: 800;
    color: var(--primary);
}

.novo-recorde {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, #ffd700, #ffb300);
    color: white;
    padding: 10px 20px;
    border-radius: var(--radius-full);
    font-weight: 600;
    margin-top: 16px;
    animation: bounce 0.5s ease infinite alternate;
}

@keyframes bounce {
    from { transform: translateY(0); }
    to { transform: translateY(-4px); }
}

/* Stats Resultado */
.resultado-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 32px;
}

.stat-resultado {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 14px;
    box-shadow: var(--shadow-sm);
}

.stat-icone {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1rem;
}

.stat-icone.acertos { background: var(--success); }
.stat-icone.erros { background: var(--error); }
.stat-icone.tempo { background: var(--secondary); }
.stat-icone.sequencia { background: #ff9800; }

.stat-info strong {
    display: block;
    font-size: 1.2rem;
    color: var(--text-primary);
}

.stat-info span {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* Botões de Ação */
.resultado-acoes {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.btn-acao {
    padding: 16px 24px;
    border-radius: var(--radius-full);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: var(--transition);
    text-decoration: none;
    border: none;
}

.btn-acao:active {
    transform: scale(0.98);
}

.btn-acao.primary {
    background: var(--gradient);
    color: white;
    box-shadow: var(--shadow-primary);
}

.btn-acao.secondary {
    background: var(--bg-card);
    color: var(--primary);
    border: 2px solid var(--primary);
}

.btn-acao.outline {
    background: transparent;
    color: var(--text-secondary);
    border: 2px solid var(--bg-primary);
}

/* ===== RESPONSIVO ===== */
@media (max-width: 360px) {
    .pergunta-texto {
        font-size: 1.1rem;
    }
    
    .opcoes-grid {
        grid-template-columns: 1fr;
    }
    
    .resultado-stats {
        grid-template-columns: 1fr;
    }
}

/* ===== ANIMAÇÕES EXTRAS ===== */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

.shake {
    animation: shake 0.3s ease;
}

@keyframes celebrate {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

.celebrate {
    animation: celebrate 0.5s ease;
}

/* Botão Reset */
.btn-reset {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: rgba(244, 67, 54, 0.1);
    color: var(--error);
    font-size: 1rem;
    cursor: pointer;
    transition: var(--transition);
    margin-left: auto;
}

.btn-reset:active {
    transform: scale(0.9);
    background: var(--error);
    color: white;
}

/* Modal de Confirmação */
.modal-confirmacao {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}

.modal-confirmacao.show {
    display: flex;
}

.modal-confirmacao-content {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    padding: 32px 24px;
    text-align: center;
    max-width: 320px;
    width: 100%;
    animation: scaleIn 0.3s ease;
}

.modal-confirmacao-icon {
    width: 70px;
    height: 70px;
    background: rgba(244, 67, 54, 0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    color: var(--error);
    font-size: 2rem;
}

.modal-confirmacao h3 {
    font-size: 1.3rem;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.modal-confirmacao p {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-bottom: 24px;
}

.modal-confirmacao-btns {
    display: flex;
    gap: 12px;
}

.btn-cancelar, .btn-confirmar-reset {
    flex: 1;
    padding: 14px;
    border-radius: var(--radius-full);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    border: none;
}

.btn-cancelar {
    background: var(--bg-primary);
    color: var(--text-secondary);
}

.btn-confirmar-reset {
    background: var(--error);
    color: white;
}

.btn-cancelar:active, .btn-confirmar-reset:active {
    transform: scale(0.98);
}

/* Toast de Feedback */
.toast {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: var(--bg-card);
    color: var(--success);
    padding: 14px 24px;
    border-radius: var(--radius-full);
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    opacity: 0;
    transition: var(--transition);
    z-index: 2000;
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.toast i {
    font-size: 1.2rem;
}
