/* ============================================================
 * Mundo Mágico da Criança — Estilos
 * Organizado por secções. Mantém a identidade visual original
 * com pequenos polimentos (acessibilidade e movimento reduzido).
 * ============================================================ */

/* ---------- Base ---------- */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}

:root {
  --cor-primaria: #ff6b6b;
  --cor-secundaria: #4ecdc4;
  --cor-destaque: #feca57;
  --cor-acerto: #2ecc71;
  --cor-erro: #e74c3c;
  --sombra-cartao: 0 10px 30px rgba(0, 0, 0, 0.2);
}

body {
  font-family: 'Comic Sans MS', 'Chalkboard', 'Arial Rounded MT Bold', sans-serif;
  overflow: hidden;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
  height: 100vh;
  width: 100vw;
  position: relative;
}

/* Foco visível para navegação por teclado/leitor (acessibilidade) */
:focus-visible {
  outline: 4px solid #fff;
  outline-offset: 3px;
  border-radius: 8px;
}

/* ---------- Bolhas de fundo ---------- */
.bubble {
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  animation: float 8s infinite ease-in-out;
  pointer-events: none;
}

@keyframes float {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-30px) rotate(180deg); }
}

/* ---------- Tela inicial ---------- */
#tela-inicial {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100vh;
  text-align: center;
  padding: 20px;
}

.logo {
  font-size: 3rem;
  color: #fff;
  text-shadow: 3px 3px 0px #ff6b6b, 6px 6px 0px #4ecdc4;
  margin-bottom: 10px;
  animation: bounce 2s infinite;
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-15px); }
}

.subtitulo {
  font-size: 1.3rem;
  color: #fff;
  margin-bottom: 40px;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.btn-jogar {
  background: linear-gradient(45deg, #ff6b6b, #feca57);
  border: none;
  padding: 20px 60px;
  font-size: 1.8rem;
  color: white;
  border-radius: 50px;
  cursor: pointer;
  box-shadow: 0 8px 0 #e67e22, 0 15px 20px rgba(0, 0, 0, 0.2);
  transition: transform 0.1s;
  font-family: inherit;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 2px;
}

.btn-jogar:active {
  transform: translateY(8px);
  box-shadow: 0 0 0 #e67e22, 0 5px 10px rgba(0, 0, 0, 0.2);
}

.btn-jogar:hover { transform: scale(1.05); }

/* ---------- Menu de temas ---------- */
#menu-temas {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  height: 100vh;
  padding: 20px;
  overflow-y: auto;
}

.titulo-secao {
  font-size: 2.5rem;
  color: #fff;
  text-shadow: 3px 3px 0px rgba(0, 0, 0, 0.2);
  margin-bottom: 30px;
  text-align: center;
}

.grid-temas {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
  max-width: 700px;
  width: 100%;
  padding-bottom: 90px;
}

.card-tema {
  background: white;
  border-radius: 25px;
  padding: 25px;
  text-align: center;
  cursor: pointer;
  box-shadow: 0 10px 0 rgba(0, 0, 0, 0.1), 0 15px 30px rgba(0, 0, 0, 0.2);
  transition: transform 0.3s;
  border: 4px solid transparent;
  position: relative;
}

.card-tema:hover { transform: translateY(-5px) scale(1.02); }
.card-tema:active { transform: translateY(5px); }

.icone-tema { font-size: 4rem; margin-bottom: 10px; }
.nome-tema { font-size: 1.3rem; font-weight: bold; color: #333; }

.card-tema.numeros { border-color: #ff6b6b; background: linear-gradient(135deg, #ffecd2 0%, #fcb69f 100%); }
.card-tema.letras { border-color: #4ecdc4; background: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%); }
.card-tema.cores { border-color: #feca57; background: linear-gradient(135deg, #ffecd2 0%, #f6d365 100%); }
.card-tema.animais { border-color: #48dbfb; background: linear-gradient(135deg, #d4fc79 0%, #96e6a1 100%); }
.card-tema.formas { border-color: #ff9ff3; background: linear-gradient(135deg, #fad0c4 0%, #ffd1ff 100%); }
.card-tema.natureza { border-color: #54a0ff; background: linear-gradient(135deg, #a1c4fd 0%, #c2e9fb 100%); }
.card-tema.alimentos { border-color: #ff7675; background: linear-gradient(135deg, #ffeaa7 0%, #fab1a0 100%); }
.card-tema.transportes { border-color: #0984e3; background: linear-gradient(135deg, #dfe6e9 0%, #74b9ff 100%); }
.card-tema.corpo { border-color: #fd79a8; background: linear-gradient(135deg, #ffeaa7 0%, #fd79a8 100%); }
.card-tema.casa { border-color: #a29bfe; background: linear-gradient(135deg, #dfe6e9 0%, #a29bfe 100%); }
.card-tema.higiene { border-color: #00cec9; background: linear-gradient(135deg, #81ecec 0%, #dff9fb 100%); }
.card-tema.sentimentos { border-color: #fdcb6e; background: linear-gradient(135deg, #ffecd2 0%, #fdcb6e 100%); }

/* Tema bloqueado (premium ou por estrelas) */
.card-tema.bloqueado { filter: grayscale(0.75); opacity: 0.72; }
.card-tema.bloqueado::after {
  content: '🔒';
  position: absolute;
  top: 8px;
  right: 10px;
  font-size: 1.8rem;
  background: white;
  border-radius: 50%;
  padding: 4px;
}
.card-tema.desbloqueado-progresso::after {
  content: '🎁';
  position: absolute;
  top: 8px;
  right: 10px;
  font-size: 1.5rem;
  background: white;
  border-radius: 50%;
  padding: 4px;
}
.badge-desbloqueio {
  margin-top: 8px;
  font-size: 0.9rem;
  background: rgba(255, 255, 255, 0.85);
  border-radius: 12px;
  padding: 5px 8px;
  color: #333;
  font-weight: bold;
}

/* ---------- Barra de modo / estrelas ---------- */
.linha-modo {
  display: flex;
  gap: 14px;
  align-items: center;
  justify-content: center;
  margin: -10px 0 20px;
  flex-wrap: wrap;
}
.btn-aprender, .btn-resetar {
  border: none;
  color: white;
  padding: 13px 24px;
  border-radius: 22px;
  cursor: pointer;
  font-family: inherit;
  font-weight: bold;
  font-size: 1.05rem;
  background: linear-gradient(45deg, #00b894, #00cec9);
  box-shadow: 0 5px 0 rgba(0, 0, 0, 0.15);
}
.total-estrelas-ui {
  background: rgba(255, 255, 255, 0.92);
  color: #333;
  padding: 12px 18px;
  border-radius: 20px;
  font-weight: bold;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.15);
}

/* ---------- Área de jogo ---------- */
#area-jogo, #tela-aprender {
  display: none;
  flex-direction: column;
  height: 100vh;
  padding: 15px;
}

.barra-topo {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
  background: rgba(255, 255, 255, 0.9);
  padding: 9px 14px;
  gap: 8px;
  border-radius: 20px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.btn-voltar {
  background: #ff6b6b;
  border: none;
  color: white;
  padding: 10px 20px;
  border-radius: 15px;
  font-size: 1rem;
  cursor: pointer;
  font-family: inherit;
  font-weight: bold;
  box-shadow: 0 4px 0 #c0392b;
}
.btn-voltar:active { transform: translateY(4px); box-shadow: 0 0 0 #c0392b; }

.pontuacao { font-size: 1.3rem; font-weight: bold; color: #333; white-space: nowrap; }
.estrelas { font-size: 1.5rem; }

.conteudo-jogo {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.95);
  border-radius: 30px;
  padding: 20px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
  overflow-y: auto;
}

.pergunta {
  font-size: 1.8rem;
  color: #333;
  margin-bottom: 20px;
  text-align: center;
  font-weight: bold;
}

.opcoes {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 15px;
  width: 100%;
  max-width: 500px;
}

.opcao {
  padding: 25px;
  font-size: 1.5rem;
  border: 4px solid #ddd;
  border-radius: 20px;
  cursor: pointer;
  text-align: center;
  font-family: inherit;
  font-weight: bold;
  transition: transform 0.2s;
  background: white;
  color: #333;
}
.opcao:hover { transform: scale(1.05); }
.opcao.certa { background: var(--cor-acerto) !important; border-color: #27ae60 !important; color: white; animation: pulse 0.5s; }
.opcao.errada { background: var(--cor-erro) !important; border-color: #c0392b !important; color: white; animation: shake 0.5s; }
.opcao:disabled { opacity: 0.7; cursor: not-allowed; }

@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.1); } }
@keyframes shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-10px); } 75% { transform: translateX(10px); } }

.circulo-cor {
  width: 120px; height: 120px; border-radius: 50%;
  margin: 20px auto; box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2); border: 5px solid white;
}
.forma-display { width: 150px; height: 150px; margin: 20px auto; display: flex; align-items: center; justify-content: center; font-size: 6rem; }
.animal-display { font-size: 8rem; margin: 20px; animation: wiggle 2s infinite; }
@keyframes wiggle { 0%, 100% { transform: rotate(-5deg); } 50% { transform: rotate(5deg); } }

.feedback {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%);
  font-size: 5rem; display: none; z-index: 1000; animation: popIn 0.5s; pointer-events: none;
}
@keyframes popIn {
  0% { transform: translate(-50%, -50%) scale(0); }
  80% { transform: translate(-50%, -50%) scale(1.2); }
  100% { transform: translate(-50%, -50%) scale(1); }
}

.barra-progresso { width: 100%; height: 15px; background: #ecf0f1; border-radius: 10px; margin-top: 20px; overflow: hidden; }
.progresso { height: 100%; background: linear-gradient(90deg, #f093fb 0%, #f5576c 100%); border-radius: 10px; transition: width 0.5s; width: 0%; }

.tentativas-indicador { font-size: 1.2rem; color: #666; margin-top: 15px; font-weight: bold; }

.btn-ouvir {
  background: linear-gradient(45deg, #9b59b6, #8e44ad);
  border: none; color: white; padding: 12px 30px; border-radius: 25px;
  font-size: 1.2rem; cursor: pointer; font-family: inherit; font-weight: bold;
  margin-bottom: 20px; box-shadow: 0 6px 0 #6c3483; display: flex; align-items: center; gap: 10px;
}
.btn-ouvir:active { transform: translateY(6px); box-shadow: 0 0 0 #6c3483; }
.btn-ouvir.pulse { animation: pulseBtn 1.5s infinite; }
@keyframes pulseBtn {
  0%, 100% { transform: scale(1); box-shadow: 0 6px 0 #6c3483; }
  50% { transform: scale(1.05); box-shadow: 0 8px 0 #6c3483, 0 0 20px rgba(155, 89, 182, 0.5); }
}

/* ---------- Mascote ---------- */
.mascote-card {
  width: 100%; max-width: 520px; margin: 0 auto 15px;
  background: linear-gradient(135deg, #fff7d6, #ffffff);
  border: 4px solid #feca57; border-radius: 26px; padding: 14px;
  display: flex; align-items: center; justify-content: center; gap: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}
.mascote-emoji { font-size: 4.2rem; line-height: 1; transition: transform 0.25s; }
.fala-mascote {
  font-size: 1.15rem; color: #333; font-weight: bold; background: #fff;
  padding: 12px 15px; border-radius: 18px; min-height: 48px; display: flex; align-items: center;
}
.mascote-feliz .mascote-emoji { animation: bounce 0.7s infinite; }
.mascote-erro .mascote-emoji { animation: shake 0.5s; }
.mascote-pensa .mascote-emoji { animation: wiggle 1.4s infinite; }

/* ---------- Modo Aprender ---------- */
.conteudo-aprender {
  flex: 1; background: rgba(255, 255, 255, 0.95); border-radius: 30px;
  padding: 18px; overflow-y: auto; box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}
.grid-aprender { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; max-width: 680px; margin: 0 auto; }
.item-aprender {
  border: none; border-radius: 24px; background: linear-gradient(135deg, #fff, #f7f7ff);
  padding: 18px; font-family: inherit; font-weight: bold; font-size: 1.15rem; color: #333; cursor: pointer;
  box-shadow: 0 7px 0 rgba(0, 0, 0, 0.08), 0 12px 24px rgba(0, 0, 0, 0.12);
}
.item-aprender:active { transform: translateY(5px); box-shadow: 0 2px 0 rgba(0, 0, 0, 0.08); }
.emoji-aprender { font-size: 3.5rem; display: block; margin-bottom: 8px; }

/* ---------- Tela de parabéns ---------- */
#tela-parabens {
  display: none; position: fixed; inset: 0; background: rgba(0, 0, 0, 0.8);
  z-index: 2000; flex-direction: column; align-items: center; justify-content: center;
}
.caixa-parabens { background: white; padding: 40px; border-radius: 30px; text-align: center; animation: slideIn 0.5s; }
@keyframes slideIn { from { transform: translateY(-100px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.trofeu { font-size: 6rem; margin-bottom: 20px; }
.texto-parabens { font-size: 2rem; color: #333; margin-bottom: 20px; }
.btn-continuar {
  background: linear-gradient(45deg, #2ecc71, #27ae60); border: none; padding: 15px 40px;
  font-size: 1.5rem; color: white; border-radius: 25px; cursor: pointer; font-family: inherit; font-weight: bold;
  box-shadow: 0 6px 0 #1e8449;
}
.btn-continuar:active { transform: translateY(6px); box-shadow: 0 0 0 #1e8449; }

/* ---------- Confetti ---------- */
.confetti { position: fixed; width: 13px; height: 13px; top: -10px; animation: cair 3s linear forwards; z-index: 3000; }
@keyframes cair { to { transform: translateY(100vh) rotate(720deg); } }

/* ---------- Botões flutuantes ---------- */
.btn-som, .btn-definicoes {
  position: fixed; right: 15px; background: white; border: none; width: 50px; height: 50px;
  border-radius: 50%; font-size: 1.5rem; cursor: pointer; box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2); z-index: 100;
}
.btn-som { top: 15px; }
.btn-definicoes { top: 75px; }

/* ---------- Mensagem de voz (legenda) ---------- */
.mensagem-voz {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.8); color: white; padding: 15px 30px; border-radius: 30px;
  font-size: 1.2rem; z-index: 500; display: none; text-align: center; max-width: 90%;
}
.mensagem-voz.mostrar { display: block; animation: fadeInUp 0.3s; }
@keyframes fadeInUp {
  from { opacity: 0; transform: translateX(-50%) translateY(20px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ---------- Definições ---------- */
#tela-definicoes {
  display: none; position: fixed; inset: 0; background: rgba(0, 0, 0, 0.65);
  z-index: 2500; align-items: center; justify-content: center; padding: 20px;
}
.caixa-definicoes {
  width: 100%; max-width: 480px; max-height: 92vh; overflow-y: auto; background: #fff;
  border-radius: 30px; padding: 25px; box-shadow: 0 15px 40px rgba(0, 0, 0, 0.3); border: 5px solid #feca57;
}
.titulo-definicoes { font-size: 2rem; color: #333; text-align: center; margin-bottom: 20px; }
.campo-definicao { margin-bottom: 15px; }
.campo-definicao label { display: block; font-size: 1.1rem; color: #333; font-weight: bold; margin-bottom: 6px; }
.campo-definicao select, .campo-definicao input[type="range"] {
  width: 100%; padding: 12px; border-radius: 15px; border: 3px solid #ddd; font-family: inherit; font-size: 1rem; background: white;
}
.linha-botoes-def { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 20px; }
.btn-teste-voz, .btn-fechar-def {
  border: none; color: white; padding: 14px 16px; border-radius: 20px; cursor: pointer;
  font-family: inherit; font-weight: bold; font-size: 1rem;
}
.btn-teste-voz { background: linear-gradient(45deg, #4ecdc4, #54a0ff); }
.btn-fechar-def { background: linear-gradient(45deg, #ff6b6b, #feca57); }
.aviso-def { margin-top: 10px; color: #666; font-size: 0.9rem; text-align: center; }

/* ---------- Bloco Premium (nas definições) ---------- */
.modo-produto { margin-top: 14px; padding: 14px; border-radius: 18px; background: linear-gradient(135deg, #fff7d6 0%, #ffeaa7 100%); border: 3px dashed #f39c12; }
.modo-produto h3 { margin-bottom: 8px; color: #333; font-size: 1.05rem; }
.modo-produto p { color: #555; font-size: 0.88rem; margin-bottom: 10px; line-height: 1.35; }
.codigo-desbloqueio {
  width: 100%; padding: 12px; border: 3px solid #f6b93b; border-radius: 15px; font-family: inherit;
  font-size: 1rem; text-align: center; text-transform: uppercase; background: white;
}
.linha-premium { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }
.btn-comprar, .btn-premium, .btn-bloquear {
  border: none; color: white; padding: 12px; border-radius: 16px; cursor: pointer;
  font-family: inherit; font-weight: bold; font-size: 0.9rem;
}
.btn-comprar { background: linear-gradient(45deg, #f39c12, #e67e22); grid-column: 1 / -1; }
.btn-premium { background: linear-gradient(45deg, #00b894, #00cec9); }
.btn-bloquear { background: linear-gradient(45deg, #636e72, #2d3436); }
.estado-premium { margin-top: 8px; text-align: center; font-size: 0.9rem; font-weight: bold; color: #333; }

/* ---------- Aviso de tema premium ---------- */
#tela-desbloqueio {
  display: none; position: fixed; inset: 0; background: rgba(0, 0, 0, 0.72);
  z-index: 2600; align-items: center; justify-content: center; padding: 18px;
}
.caixa-desbloqueio {
  background: white; border-radius: 30px; padding: 28px; max-width: 420px; width: 100%;
  text-align: center; box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35); animation: slideIn 0.35s;
}
.caixa-desbloqueio .cadeado { font-size: 4rem; margin-bottom: 8px; }
.caixa-desbloqueio h2 { color: #333; margin-bottom: 10px; }
.caixa-desbloqueio p { color: #666; line-height: 1.4; margin-bottom: 18px; }
.btn-fechar-premium {
  margin-top: 10px; border: none; color: white; background: linear-gradient(45deg, #ff6b6b, #feca57);
  padding: 12px 22px; border-radius: 18px; cursor: pointer; font-family: inherit; font-weight: bold;
}

/* ---------- Rodapé ---------- */
.rodape-app {
  position: fixed; left: 50%; bottom: 10px; transform: translateX(-50%);
  width: calc(100% - 30px); max-width: 760px; text-align: center;
  color: rgba(255, 255, 255, 0.95); font-size: 0.82rem; text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.35);
  z-index: 50; pointer-events: none;
}
.rodape-app strong { color: #fff; }

/* ---------- Fundos desbloqueáveis ---------- */
body.fundo-floresta { background: linear-gradient(135deg, #11998e 0%, #38ef7d 55%, #d4fc79 100%); }
body.fundo-oceano { background: linear-gradient(135deg, #2193b0 0%, #6dd5ed 55%, #ffffff 100%); }
body.fundo-espaco { background: radial-gradient(circle at top, #2b5876 0%, #4e4376 45%, #0f2027 100%); }

/* ---------- Responsivo ---------- */
@media (max-width: 600px) {
  .logo { font-size: 2rem; }
  .grid-temas { gap: 15px; }
  .card-tema { padding: 15px; }
  .icone-tema { font-size: 3rem; }
  .nome-tema { font-size: 1rem; }
  .pergunta { font-size: 1.3rem; }
  .opcao { padding: 15px; font-size: 1.2rem; }
  .rodape-app { font-size: 0.68rem; bottom: 6px; }
  .linha-premium { grid-template-columns: 1fr; }
  .pontuacao { font-size: 1.15rem; }
  .contador-pergunta { font-size: 0.82rem; padding: 4px 9px; }
  .btn-voltar { padding: 9px 13px; font-size: 0.9rem; }
}

/* ---------- Melhorias de UI ---------- */
/* Esconde os botões flutuantes durante o jogo/aprender (evita sobreposição com a barra de topo) */
body.tela-jogo .btn-som,
body.tela-jogo .btn-definicoes { display: none; }

/* Contador "Pergunta X de 10" na barra de topo */
.contador-pergunta {
  font-weight: bold; color: #333; font-size: 1rem; white-space: nowrap;
  background: rgba(255, 255, 255, 0.65); padding: 5px 12px; border-radius: 16px;
}

/* Opções não transbordam com texto longo */
.opcao { overflow-wrap: break-word; word-break: break-word; min-width: 0; }

/* Definições: secções, legendas dos sliders, botões */
.def-secao {
  font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.5px;
  color: #9098b0; font-weight: 700; margin: 18px 0 8px; border-top: 2px solid #eef; padding-top: 14px;
}
.def-secao:first-of-type { border-top: none; padding-top: 0; margin-top: 4px; }
.slider-legenda { display: flex; justify-content: space-between; font-size: 0.72rem; color: #999; margin-top: 3px; }
.btn-perigo { background: linear-gradient(45deg, #e74c3c, #c0392b) !important; box-shadow: 0 5px 0 #922 !important; }
.link-codigo {
  background: none; border: none; color: #5b5bd6; text-decoration: underline;
  cursor: pointer; font-family: inherit; font-size: 0.9rem; padding: 8px 0; width: 100%; text-align: center;
}

/* Respeita quem prefere menos movimento (acessibilidade) */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}
