* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Segoe UI', sans-serif;
  background: #f0f4ff;
  min-height: 100vh;
  color: #2d2d2d;
}

.tela {
  display: none;
  max-width: 620px;
  margin: 0 auto;
  padding: 24px 20px 60px;
}
.tela.ativa { display: block; }

/* CABECALHO */
.cabecalho { text-align: center; margin-bottom: 24px; }
.cabecalho h1 { font-size: 2rem; color: #3a3a8c; }
.subtitulo { color: #666; margin-top: 4px; font-size: 1rem; }

/* STATS */
.stats-resumo {
  display: flex; gap: 12px; margin-bottom: 24px;
  flex-wrap: wrap; justify-content: center;
}
.stat-chip {
  background: white; border-radius: 12px; padding: 10px 16px;
  font-size: 0.85rem; box-shadow: 0 2px 8px rgba(0,0,0,0.07); text-align: center;
}
.stat-chip strong { display: block; font-size: 1.4rem; color: #3a3a8c; }

/* BOTOES INICIO */
.botoes-inicio { display: flex; gap: 12px; margin-bottom: 32px; flex-wrap: wrap; }
.btn-grande {
  flex: 1; min-width: 120px;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 20px 12px; border: none; border-radius: 16px; cursor: pointer;
  font-size: 0.95rem; font-weight: 600;
  transition: transform 0.1s, box-shadow 0.1s;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}
.btn-grande:active { transform: scale(0.97); }
.btn-grande .icone { font-size: 1.8rem; }
.btn-estudar { background: linear-gradient(135deg, #667eea, #764ba2); color: white; }
.btn-teste { background: linear-gradient(135deg, #f093fb, #f5576c); color: white; }
.btn-adicionar { background: linear-gradient(135deg, #11998e, #38ef7d); color: white; }

/* MATERIAS LISTA */
.materias-lista { display: flex; flex-direction: column; gap: 12px; }
.materia-card {
  background: white; border-radius: 14px; padding: 16px 20px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.07);
  display: flex; justify-content: space-between; align-items: center;
}
.materia-info h3 { font-size: 1rem; color: #3a3a8c; }
.materia-info p { font-size: 0.8rem; color: #888; margin-top: 2px; }
.materia-badges { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.badge { padding: 4px 10px; border-radius: 20px; font-size: 0.75rem; font-weight: 600; }
.badge-revisar { background: #fff3cd; color: #856404; }
.badge-dominados { background: #d1fae5; color: #065f46; }

/* FORMULARIO */
h2 { font-size: 1.5rem; color: #3a3a8c; margin-bottom: 24px; }
.form-grupo { margin-bottom: 20px; }
.form-grupo label { display: block; font-weight: 600; margin-bottom: 10px; color: #444; }
.opcoes-materia { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.chip {
  padding: 8px 16px; border: 2px solid #ddd; border-radius: 20px;
  background: white; cursor: pointer; font-size: 0.9rem; transition: all 0.15s;
}
.chip:hover, .chip.ativo { border-color: #667eea; background: #667eea; color: white; }

input[type="text"], textarea {
  width: 100%; padding: 12px 16px; border: 2px solid #ddd; border-radius: 12px;
  font-size: 0.95rem; font-family: inherit; transition: border-color 0.15s; resize: vertical;
}
input[type="text"]:focus, textarea:focus { outline: none; border-color: #667eea; }

/* ZONA IMAGEM */
.zona-imagem {
  border: 2px dashed #aab4f0; border-radius: 12px; padding: 24px;
  text-align: center; cursor: pointer; background: #f8f9ff;
  transition: all 0.2s; margin-bottom: 0;
}
.zona-imagem:hover, .zona-imagem.dragover { border-color: #667eea; background: #eef0ff; }
.zona-imagem.tem-imagem { border-color: #11998e; background: #f0fdfb; }
#zona-imagem-conteudo {
  display: flex; flex-direction: column; align-items: center;
  gap: 4px; color: #888; font-size: 0.9rem; pointer-events: none;
}
.zona-icone { font-size: 2rem; margin-bottom: 4px; }
.zona-sub { font-size: 0.75rem; color: #bbb; }
.zona-preview { max-width: 100%; max-height: 200px; border-radius: 8px; object-fit: contain; }
.separador {
  display: flex; align-items: center; gap: 12px;
  color: #bbb; font-size: 0.85rem; margin: 14px 0;
}
.separador::before, .separador::after { content: ''; flex: 1; height: 1px; background: #ddd; }

/* BOTOES */
.btn-principal {
  width: 100%; padding: 16px;
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: white; border: none; border-radius: 14px;
  font-size: 1rem; font-weight: 700; cursor: pointer; transition: opacity 0.15s;
}
.btn-principal:hover { opacity: 0.9; }
.btn-principal:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-voltar {
  background: none; border: none; color: #667eea;
  font-size: 1rem; cursor: pointer; padding: 0; margin-bottom: 20px; font-weight: 600;
}

/* MENSAGENS */
.msg-info {
  margin-top: 16px; padding: 14px; background: #e8f4fd;
  border-radius: 10px; text-align: center; color: #1a6fa8;
}
.msg-sucesso {
  margin-top: 16px; padding: 14px; background: #d1fae5;
  border-radius: 10px; text-align: center; color: #065f46; font-weight: 600;
}

/* PROGRESSO */
.progresso-bar {
  height: 8px; background: #ddd; border-radius: 4px; margin-bottom: 8px; overflow: hidden;
}
#barra-progresso, #barra-progresso-teste {
  height: 100%; background: linear-gradient(90deg, #667eea, #764ba2);
  border-radius: 4px; transition: width 0.4s ease;
}
.progresso-texto { text-align: right; font-size: 0.8rem; color: #888; margin-bottom: 24px; }

/* CARD FLASHCARD */
.card {
  background: white; border-radius: 20px; padding: 32px 28px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.1); text-align: center;
}
.card-materia {
  font-size: 0.8rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 1px; color: #667eea; margin-bottom: 8px;
}
.card-emoji { font-size: 3rem; margin-bottom: 16px; }
.card-pergunta {
  font-size: 1.2rem; font-weight: 600; line-height: 1.5;
  color: #2d2d2d; margin-bottom: 28px; min-height: 60px;
}
.card-resposta {
  background: #f0f4ff; border-radius: 12px; padding: 16px;
  font-size: 1rem; color: #3a3a8c; margin-bottom: 24px; line-height: 1.5;
}
.btn-ver-resposta {
  width: 100%; padding: 14px; background: #f0f4ff;
  color: #667eea; border: 2px solid #667eea; border-radius: 12px;
  font-size: 1rem; font-weight: 700; cursor: pointer; transition: all 0.15s;
}
.btn-ver-resposta:hover { background: #667eea; color: white; }
.pergunta-avaliacao { font-size: 0.9rem; color: #666; margin-bottom: 12px; }
.botoes-resposta { display: flex; flex-direction: column; gap: 10px; }
.btn-errei, .btn-acertei {
  width: 100%; padding: 14px; border: none; border-radius: 12px;
  font-size: 1rem; font-weight: 700; cursor: pointer; transition: opacity 0.15s;
}
.btn-errei { background: #fee2e2; color: #dc2626; }
.btn-acertei { background: #d1fae5; color: #059669; }
.btn-errei:hover, .btn-acertei:hover { opacity: 0.8; }

/* FIM REVISAO */
.revisao-fim { text-align: center; padding-top: 40px; }
.fim-icone { font-size: 5rem; margin-bottom: 16px; }
.revisao-fim h2 { font-size: 1.8rem; color: #3a3a8c; text-align: center; }
.revisao-fim p { color: #666; margin: 12px 0 24px; font-size: 1rem; }

/* MOTIVACIONAL */
.msg-motivacional {
  background: linear-gradient(135deg, #667eea22, #764ba222);
  border-left: 4px solid #667eea;
  border-radius: 12px;
  padding: 14px 18px;
  font-size: 1rem;
  color: #3a3a8c;
  font-weight: 600;
  margin-bottom: 24px;
  line-height: 1.5;
}

/* ESCOLHER TESTE */
.opcoes-prova { display: flex; gap: 12px; flex-wrap: wrap; }
.card-prova {
  flex: 1; min-width: 120px;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 20px 12px; border: 2px solid #ddd; border-radius: 16px;
  background: white; cursor: pointer; transition: all 0.15s;
}
.card-prova:hover { border-color: #667eea; }
.card-prova.ativo { border-color: #667eea; background: #f0f4ff; }
.prova-icone { font-size: 2rem; }
.card-prova strong { font-size: 1.1rem; color: #3a3a8c; }
.card-prova span { font-size: 0.8rem; color: #888; }

/* QUESTAO TESTE */
.questao-card {
  background: white; border-radius: 20px; padding: 28px 24px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.1);
}
.questao-tipo {
  font-size: 0.75rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 1px; margin-bottom: 12px; padding: 4px 10px;
  border-radius: 20px; display: inline-block;
}
.tipo-multipla { background: #e0e7ff; color: #4338ca; }
.tipo-dissertativa { background: #fce7f3; color: #be185d; }
.questao-enunciado {
  font-size: 1.1rem; font-weight: 600; line-height: 1.5;
  color: #2d2d2d; margin-bottom: 24px;
}
.alternativas { display: flex; flex-direction: column; gap: 10px; margin-bottom: 20px; }
.alternativa {
  padding: 14px 18px; border: 2px solid #ddd; border-radius: 12px;
  background: white; cursor: pointer; font-size: 0.95rem;
  text-align: left; transition: all 0.15s; font-family: inherit;
}
.alternativa:hover:not(:disabled) { border-color: #667eea; background: #f0f4ff; }
.alternativa.selecionada { border-color: #667eea; background: #e0e7ff; }
.alternativa.correta { border-color: #059669; background: #d1fae5; color: #065f46; font-weight: 700; }
.alternativa.errada { border-color: #dc2626; background: #fee2e2; color: #dc2626; }
.alternativa:disabled { cursor: default; }

.campo-dissertativa {
  width: 100%; padding: 14px; border: 2px solid #ddd; border-radius: 12px;
  font-size: 0.95rem; font-family: inherit; resize: vertical; min-height: 100px;
  margin-bottom: 16px; transition: border-color 0.15s;
}
.campo-dissertativa:focus { outline: none; border-color: #667eea; }
.campo-dissertativa:disabled { background: #f5f5f5; color: #666; }

.btn-responder {
  width: 100%; padding: 14px;
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: white; border: none; border-radius: 12px;
  font-size: 1rem; font-weight: 700; cursor: pointer; transition: opacity 0.15s;
  margin-bottom: 12px;
}
.btn-responder:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-proxima {
  width: 100%; padding: 14px; background: white;
  color: #667eea; border: 2px solid #667eea; border-radius: 12px;
  font-size: 1rem; font-weight: 700; cursor: pointer;
}

.feedback-box {
  padding: 14px; border-radius: 12px; margin-bottom: 16px;
  font-size: 0.95rem; line-height: 1.5; text-align: center;
}
.feedback-acerto { background: #d1fae5; color: #065f46; }
.feedback-erro { background: #fee2e2; color: #dc2626; }

/* RESUMO FINAL TESTE */
.resumo-teste { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; }
.resumo-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 16px; border-radius: 12px; font-size: 0.9rem;
}
.resumo-acerto { background: #d1fae5; color: #065f46; }
.resumo-erro { background: #fee2e2; color: #dc2626; }
.nota-grande {
  font-size: 3rem; font-weight: 900; color: #3a3a8c; margin: 8px 0;
}
