* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: #0f1e33;
  background: linear-gradient(160deg, #0f1e33 0%, #16324f 100%);
  color: #1a1a1a;
  user-select: none;
}

.topo {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 28px;
  background: #0a1626;
  color: #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}
.marca { font-weight: 700; font-size: 18px; letter-spacing: 0.5px; }
.marca span { font-weight: 400; color: #8fb8e8; }
.marca-edicao { font-weight: 600; color: #fff; }

.edicao-badge {
  display: inline-block;
  background: #eef4fb;
  color: #16324f;
  border: 1px solid #cdddf0;
  border-radius: 20px;
  padding: 4px 14px;
  font-size: 13px;
  font-weight: 700;
  margin: -6px 0 10px;
}

.cronometro {
  font-size: 22px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  background: #1c3a5e;
  padding: 6px 16px;
  border-radius: 8px;
  color: #ffd166;
}
.cronometro.alerta { color: #ff5c5c; }
.oculto { display: none !important; }

main#app {
  min-height: calc(100vh - 60px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.tela { display: none; width: 100%; max-width: 720px; }
.tela.ativa { display: flex; justify-content: center; }

.cartao {
  background: #ffffff;
  border-radius: 16px;
  padding: 36px 40px;
  width: 100%;
  box-shadow: 0 10px 40px rgba(0,0,0,0.35);
}

h1 { margin: 0 0 4px; font-size: 26px; color: #0f1e33; }
h2 { margin: 0 0 18px; font-size: 18px; color: #2c5580; font-weight: 500; }
.descricao { color: #555; line-height: 1.5; }

form { display: flex; flex-direction: column; gap: 16px; margin-top: 20px; }
label { display: flex; flex-direction: column; gap: 6px; font-size: 14px; color: #333; font-weight: 600; }
input {
  font-size: 15px;
  padding: 10px 12px;
  border: 1px solid #ccc;
  border-radius: 8px;
  font-family: inherit;
}
input:focus { outline: none; border-color: #2c5580; box-shadow: 0 0 0 3px rgba(44,85,128,0.15); }

.botao-primario, .botao-secundario {
  font-size: 15px;
  font-weight: 600;
  padding: 12px 20px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  transition: transform 0.1s, opacity 0.2s;
}
.botao-primario { background: #16324f; color: #fff; }
.botao-primario:hover { opacity: 0.9; }
.botao-primario:active { transform: scale(0.98); }
.botao-secundario { background: #eef2f6; color: #16324f; }
.botao-secundario:disabled { opacity: 0.4; cursor: not-allowed; }

.cartao-cadastro { max-width: 640px; }
.cadastro-cabecalho { display: flex; align-items: center; gap: 14px; margin-bottom: 2px; }
.cadastro-icone {
  font-size: 30px;
  width: 52px; height: 52px;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #eef4fb, #dbe8f7);
  border-radius: 14px;
}
.cadastro-cabecalho h1 { margin-bottom: 2px; }
.cadastro-cabecalho h2 { margin-bottom: 0; }

.form-secao {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding-top: 18px;
  border-top: 1px solid #e8edf3;
}
.form-secao:first-of-type { padding-top: 4px; border-top: none; }
.form-secao-titulo {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: #6b8bb0;
}
.curso-cards { display: flex; flex-wrap: wrap; gap: 10px; }
.curso-card {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1 1 220px;
  padding: 12px 14px;
  border: 2px solid #e2e8f0;
  border-radius: 10px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.curso-card:hover { border-color: #9db8d6; }
.curso-card.selecionado { border-color: #16324f; background: #eef4fb; }
.curso-card input[type="radio"] { display: none; }
.curso-card-check {
  width: 20px; height: 20px;
  flex-shrink: 0;
  border: 2px solid #c3d2e3;
  border-radius: 5px;
  display: flex; align-items: center; justify-content: center;
  transition: border-color 0.15s, background 0.15s;
}
.curso-card.selecionado .curso-card-check { background: #16324f; border-color: #16324f; }
.curso-card.selecionado .curso-card-check::after {
  content: "✓";
  color: #fff;
  font-size: 13px;
  font-weight: 700;
}
.curso-card-info { display: flex; flex-direction: column; gap: 2px; }
.curso-card-nome { font-size: 14px; font-weight: 600; color: #16324f; }
.curso-card-vagas { font-size: 12px; color: #789; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid-cep { grid-template-columns: 0.8fr 1.6fr; }
.form-grid-numero { grid-template-columns: 0.7fr 1.7fr; }
@media (max-width: 560px) {
  .form-grid, .form-grid-cep, .form-grid-numero { grid-template-columns: 1fr; }
}

.alerta-erro {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: #fdecec;
  border: 1px solid #f5c2c2;
  color: #a52a2a;
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 13.5px;
  line-height: 1.5;
}
.alerta-erro-icone { font-size: 16px; flex-shrink: 0; }

.regras { line-height: 1.8; color: #333; padding-left: 20px; margin-bottom: 24px; }
.regras strong { color: #16324f; }

.barra-progresso {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 4px;
  background: rgba(255,255,255,0.15);
  z-index: 5;
}
.barra-progresso-fill {
  height: 100%;
  background: #ffd166;
  width: 0%;
  transition: width 0.3s;
}

.cartao-prova { max-width: 640px; }
.cabecalho-questao { font-size: 13px; color: #888; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 8px; }
#texto-enunciado { font-size: 20px; color: #0f1e33; margin-bottom: 20px; }

.alternativas { display: flex; flex-direction: column; gap: 10px; margin-bottom: 24px; }
.opcao {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 2px solid #e2e8f0;
  border-radius: 10px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.opcao:hover { border-color: #9db8d6; }
.opcao.selecionada { border-color: #16324f; background: #eef4fb; }
.opcao input { display: none; }
.opcao .letra {
  width: 26px; height: 26px;
  border-radius: 50%;
  background: #eef2f6;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px; color: #16324f;
  flex-shrink: 0;
}
.opcao.selecionada .letra { background: #16324f; color: #fff; }
.opcao .texto-opcao { font-size: 15px; color: #222; }

.navegacao { display: flex; justify-content: space-between; gap: 12px; }
.navegacao .botao-primario, .navegacao .botao-secundario { flex: 1; }

.resultado-nota { text-align: center; margin: 24px 0 8px; }
#resultado-percentual { font-size: 56px; font-weight: 800; color: #16324f; }
#resultado-detalhe { color: #666; margin-top: 4px; }
.resultado-status { text-align: center; font-size: 18px; font-weight: 700; padding: 10px; border-radius: 8px; }
.resultado-status.aprovado { background: #e5f7ec; color: #1e7e42; }
.resultado-status.reprovado { background: #fdecec; color: #c0392b; }

.erro { color: #c0392b; font-size: 14px; margin-top: 8px; }

.bloco-redacao { margin-bottom: 24px; }
.bloco-redacao textarea {
  width: 100%;
  font-family: inherit;
  font-size: 15px;
  padding: 14px;
  border: 1px solid #ccc;
  border-radius: 10px;
  resize: vertical;
  min-height: 220px;
}
.bloco-redacao textarea:focus { outline: none; border-color: #2c5580; box-shadow: 0 0 0 3px rgba(44,85,128,0.15); }
.redacao-contador { font-size: 13px; color: #777; margin-top: 6px; text-align: right; }
.redacao-contador.ok { color: #1e7e42; }

.bloco-matricula { margin-top: 24px; text-align: center; }
.matricula-status {
  margin-top: 14px;
  padding: 12px 16px;
  border-radius: 8px;
  background: #eef4fb;
  color: #16324f;
  font-size: 14px;
  line-height: 1.5;
}

.rodape-site {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 8px 16px;
  font-size: 12px;
  color: rgba(255,255,255,0.55);
  background: rgba(10,22,38,0.55);
  backdrop-filter: blur(2px);
}
.rodape-site a { color: rgba(255,255,255,0.8); text-decoration: none; }
.rodape-site a:hover { text-decoration: underline; }
.rodape-site .separador { opacity: 0.5; }
.link-aviso-legal {
  background: none;
  border: none;
  padding: 0;
  font-size: 12px;
  color: rgba(255,255,255,0.8);
  cursor: pointer;
  text-decoration: none;
}
.link-aviso-legal:hover { text-decoration: underline; }

body.exam-ativo .rodape-site { display: none; }

.cartao-aviso-legal {
  max-width: 640px;
  max-height: 85vh;
  overflow-y: auto;
  text-align: left;
  user-select: text;
}
.aviso-legal-cabecalho {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}
.aviso-legal-cabecalho h2 { margin: 0; }
.modal-fechar {
  background: none;
  border: none;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  color: #888;
  padding: 4px 8px;
}
.modal-fechar:hover { color: #333; }
.cartao-aviso-legal h3 { font-size: 15px; color: #16324f; margin: 18px 0 8px; }
.cartao-aviso-legal h3:first-of-type { margin-top: 0; }
.cartao-aviso-legal p { font-size: 13.5px; line-height: 1.6; color: #333; margin-bottom: 10px; }

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(10,22,38,0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 20px;
}
.cartao-alerta { max-width: 460px; text-align: center; border: 3px solid #ff5c5c; }
.cartao-alerta h2 { color: #c0392b; }
