@import url("https://fonts.googleapis.com/css2?family=Fredoka:wght@400;700&display=swap");

/* ==================== VARIÁVEIS ==================== */
:root {
  /* Cores */
  --cor-titulo-inicial: #4caf50;
  --cor-texto-botao: #ffffff;
  --cor-fundo-botao-inicial: #f0a830;
  --cor-fundo-opcao: #8e5f3f;
  --cor-border-bottom-botao: #d97e1e;
  --cor-border-bottom-card: #6b4329;
  --cor-correta: #00cc66;
  --cor-correta-escura: #00994d;
  --cor-incorreta: #ff4d4d;
  --cor-incorreta-escura: #cc3333;
  --cor-fundo-transparente: rgba(255, 255, 255, 0.75);
  --cor-texto: #2d3e50;
  --cor-fundo-progresso: #d8e5bc;
  --cor-destaque: #f0a830;
  --cor-titulo-pergunta: #444444;
  --cor-borda-opcao: rgba(255, 255, 255, 0.47);

  /* Bordas e sombras */
  --borda-raio-pequeno: 12px;
  --borda-raio-medio: 18px;
  --borda-raio-grande: 25px;
  --sombra-padrao: 0 4px 6px rgba(0, 0, 0, 0.1);
  --borda-padrao: 1px solid rgba(220, 230, 240, 0.5);

  /* Transições */
  --transicao-rapida: 0.3s ease;
  --transicao-normal: 0.5s ease;
}

/* ==================== ESTILOS GERAIS ==================== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: "Fredoka", sans-serif;
  -webkit-tap-highlight-color: transparent;
}

body {
  position: relative;
  background-image: url(./assets/images/01.jpg);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: background-image var(--transicao-normal);
}

body.quiz-started {
  background-image: url(./assets/images/02.jpg);
}

body::before {
  content: "";
  position: absolute;
  inset: 0;
  background: inherit;
  transition: opacity 0.8s ease-in-out;
  opacity: 1;
  z-index: -1;
}

body.quiz-started::before {
  opacity: 0;
}

/* ==================== CONTAINER DO QUIZ ==================== */
.container-quiz {
  width: 100%;
  max-width: 800px;
  padding: 50px;
  text-align: center;
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 700px;
}

/* ==================== TÍTULOS E DESCRIÇÕES ==================== */
.titulo-apresentacao,
.titulo-pergunta {
  margin: 20px;
  text-align: center;
}

.titulo-apresentacao {
  color: var(--cor-titulo-inicial);
  font-size: 45px;
  animation: pulsar 3s ease-in-out infinite;
}

.titulo-pergunta {
  color: var(--cor-titulo-pergunta);
  font-size: 35px;
  font-weight: 700;
  text-shadow: 1px 1px 0 rgba(255, 255, 255, 0.5);
}

.descricao-quiz {
  font-size: 20px;
  color: var(--cor-texto);
  margin-bottom: 30px;
  animation: surgir 0.8s ease-out forwards;
}

/* ==================== BOTÕES ==================== */
.botao {
  color: var(--cor-texto-botao);
  background: var(--cor-fundo-botao-inicial);
  border: none;
  border-radius: var(--borda-raio-grande);
  padding: 15px 30px;
  font-size: 18px;
  font-weight: bold;
  cursor: pointer;
  margin: 15px 0;
  box-shadow: 0 5px 0 var(--cor-border-bottom-botao);
  transition: transform var(--transicao-rapida), box-shadow var(--transicao-rapida);
  text-transform: uppercase;
  position: relative;
  overflow: hidden;
}

.botao:hover {
  transform: translateY(-3px);
}

.botao::after {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: 0.5s;
}

.botao:hover::after {
  left: 100%;
}

/* ==================== OPÇÕES DE RESPOSTA ==================== */
.grade-opcoes {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  grid-template-rows: repeat(2, 1fr);
  gap: 15px;
  width: 100%;
  max-width: 350px;
  margin: 20px auto 0;
  justify-items: center;
}

.botao-opcao {
  background-color: var(--cor-fundo-opcao);
  color: var(--cor-texto-botao);
  border: 2px solid var(--cor-borda-opcao);
  border-radius: var(--borda-raio-medio);
  width: 100%;
  height: 180px;
  text-align: center;
  font-size: 1.2rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transicao-normal);
  box-shadow: 0 4px 0 var(--cor-border-bottom-card), var(--sombra-padrao);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  text-decoration: none;
  position: relative;
  overflow: hidden;
}

.botao-opcao::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(rgba(255, 255, 255, 0.1), transparent);
  opacity: 0;
  transition: opacity var(--transicao-normal);
}

.botao-opcao:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 0 var(--cor-border-bottom-card), var(--sombra-padrao);
}

.botao-opcao:hover::before {
  opacity: 1;
}

.botao-opcao:active {
  transform: translateY(2px);
  box-shadow: 0 4px 0 var(--cor-border-bottom-card), var(--sombra-padrao);
}

.botao-opcao.selecionado {
  background: linear-gradient(to bottom, var(--cor-destaque), var(--cor-border-bottom-card));
  box-shadow: 0 3px 0 var(--cor-border-bottom-card), var(--sombra-padrao);
}

.botao-opcao.correta {
  background: linear-gradient(to bottom, var(--cor-correta), var(--cor-correta-escura));
  box-shadow: 0 3px 0 var(--cor-correta-escura), var(--sombra-padrao);
}

.botao-opcao.incorreta {
  background: linear-gradient(to bottom, var(--cor-incorreta), var(--cor-incorreta-escura));
  box-shadow: 0 3px 0 var(--cor-incorreta-escura), var(--sombra-padrao);
}

.opcao-imagem {
  width: 100%;
  max-height: 130px;
  object-fit: cover;
  border-radius: var(--borda-raio-pequeno);
  transition: transform var(--transicao-normal);
  overflow: hidden;
}

.botao-opcao:hover .opcao-imagem {
  transform: scale(1.04);
  filter: brightness(1.1);
}

/* ==================== BARRA DE PROGRESSO ==================== */
.container-progresso {
  width: 100%;
  height: 28px;
  background: var(--cor-fundo-progresso);
  border-radius: var(--borda-raio-pequeno);
  margin: 20px 0;
  overflow: hidden;
  border: var(--borda-padrao);
  position: relative;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.barra-progresso {
  height: 100%;
  width: 0;
  background: linear-gradient(135deg, var(--cor-destaque) 0%, #0cb415 100%);
  transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
  box-shadow: 0 0 10px rgba(24, 139, 28, 0.781);
}

.barra-progresso::after {
  content: "";
  position: absolute;
  top: 0;
  left: -50%;
  width: 150%;
  height: 100%;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.5) 50%, rgba(255, 255, 255, 0) 100%);
  animation: brilho 1.5s infinite ease-in-out;
}

.barra-progresso.atualizando {
  animation: pulso 0.5s ease-in-out;
}

/* ==================== TELAS DO QUIZ ==================== */
.tela-quiz {
  display: none;
  width: 100%;
  opacity: 0;
  position: absolute;
  inset: 0;
}

.tela-quiz.ativo {
  display: block;
  position: relative;
  opacity: 1;
}

.saida-animada {
  animation: desaparecer 0.3s ease forwards;
}

.entrada-animada {
  animation: surgir 0.5s ease forwards;
}

/* ==================== RESULTADO ==================== */
.container-resultado {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 20px 0;
}

.pontuacao {
  font-size: 40px;
  font-weight: bold;
  color: var(--cor-destaque);
  margin: 15px 0;
  animation: pulsar 2s ease-in-out infinite;
}

#mensagem-resultado {
  font-size: 32px;
  margin: 15px 0;
  color: var(--cor-texto);
}

.estatisticas {
  margin: 0 auto;
  padding: 20px;
  background: var(--cor-fundo-transparente);
  border-radius: var(--borda-raio-medio);
  box-shadow: var(--sombra-padrao);
  width: 100%;
  max-width: 500px;
}

.estatistica-item {
  margin: 10px 0;
  font-size: 18px;
}

.estatistica-item strong {
  color: var(--cor-destaque);
}

/* ==================== ANIMAÇÕES ==================== */
@keyframes surgir {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes desaparecer {
  from {
    opacity: 1;
    transform: translateY(0);
  }
  to {
    opacity: 0;
    transform: translateY(-30px);
  }
}

@keyframes pulsar {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.03);
  }
}

@keyframes brilho {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(100%);
  }
}

@keyframes pulso {
  0% {
    transform: scaleY(1);
  }
  50% {
    transform: scaleY(1.2);
  }
  100% {
    transform: scaleY(1);
  }
}

/* ==================== ACESSIBILIDADE ==================== */
@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }
  .botao:hover,
  .botao-opcao:hover {
    transform: none;
  }
}

/* ==================== RESPONSIVIDADE ==================== */
@media (max-width: 768px) {
  .container-quiz {
    padding: 30px;
  }
  .grade-opcoes {
    gap: 15px;
  }
  #mensagem-resultado {
    font-size: 28px;
  }
}

@media (max-width: 480px) {
  .container-quiz {
    padding: 15px;
  }
  .grade-opcoes {
    gap: 12px;
  }
  .pontuacao {
    font-size: 32px;
  }
  #mensagem-resultado {
    font-size: 24px;
  }
}