/* monta-palavra/jogo.css - Estilos visuais para crianças de ~5 anos */

:root {
  --cor-fundo: #FFFBEB;
  --cor-fundo-card: #FFFFFF;
  --cor-primaria: #D97706;
  --cor-primaria-hover: #B45309;
  --cor-secundaria: #3B82F6;
  --cor-sucesso: #10B981;
  --cor-sucesso-escuro: #047857;
  --cor-alerta: #F43F5E;
  --cor-texto: #1E293B;
  --cor-texto-suave: #64748B;
  --cor-borda: #CBD5E1;
  --cor-destaque: #FEF08A;
  --sombra-card: 0 8px 24px rgba(0, 0, 0, 0.08);
  --sombra-bloco: 0 6px 0 rgba(0, 0, 0, 0.15), 0 8px 12px rgba(0, 0, 0, 0.08);
  --fonte-principal: 'Comic Sans MS', 'Chalkboard SE', 'Nunito', 'Segoe UI', -apple-system, sans-serif;
}

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

body {
  font-family: var(--fonte-principal);
  background: var(--cor-fundo);
  color: var(--cor-texto);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  overflow-x: hidden;
}

.tela {
  width: 100%;
  max-width: 960px;
  min-height: 100vh;
  padding: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.oculta {
  display: none !important;
}

/* ================= Tela Inicial ================= */
#tela-inicial {
  justify-content: center;
  text-align: center;
  gap: 18px;
}

.titulo-jogo {
  font-size: 2.2rem;
  color: #B45309;
  text-shadow: 2px 2px 0 #FDE68A;
  letter-spacing: 1px;
}

.subtitulo-jogo {
  font-size: 1.15rem;
  color: var(--cor-texto-suave);
  max-width: 480px;
  line-height: 1.4;
}

.mascote-container {
  width: 150px;
  height: 150px;
  margin: 8px auto;
  filter: drop-shadow(0 10px 15px rgba(217, 119, 6, 0.15));
  animation: flutuar 3s ease-in-out infinite;
}

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

.btn-jogar-grande {
  min-width: 240px;
  min-height: 72px;
  padding: 16px 36px;
  font-size: 1.8rem;
  font-weight: 800;
  font-family: inherit;
  color: #FFFFFF;
  background: linear-gradient(180deg, #F59E0B 0%, #D97706 100%);
  border: 4px solid #78350F;
  border-radius: 40px;
  box-shadow: 0 8px 0 #78350F, 0 12px 20px rgba(217, 119, 6, 0.4);
  cursor: pointer;
  transition: transform 0.1s, box-shadow 0.1s;
}

.btn-jogar-grande:active {
  transform: translateY(6px);
  box-shadow: 0 2px 0 #78350F;
}

.opcoes-iniciais {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  align-items: center;
  margin-top: 8px;
}

.placar-estrelas-inicial {
  font-size: 1.15rem;
  font-weight: bold;
  color: #B45309;
  background: #FEF3C7;
  padding: 8px 20px;
  border-radius: 20px;
  border: 2px solid #FCD34D;
}

.btn-modo {
  min-height: 48px;
  padding: 8px 18px;
  font-size: 1rem;
  font-weight: bold;
  border-radius: 24px;
  border: 2px solid #FCD34D;
  background: #FFFFFF;
  color: #78350F;
  cursor: pointer;
}

.btn-modo:hover {
  background: #FEF3C7;
}

/* ================= Cabeçalho do Jogo ================= */
.cabecalho-jogo {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  margin-bottom: 12px;
}

.grupo-topo-esq, .grupo-topo-dir {
  display: flex;
  gap: 10px;
  align-items: center;
}

.btn-icone {
  min-width: 52px;
  min-height: 52px;
  font-size: 1.3rem;
  font-weight: bold;
  background: #FFFFFF;
  border: 3px solid #CBD5E1;
  border-radius: 16px;
  color: var(--cor-texto);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 0 #94A3B8;
  transition: transform 0.1s, box-shadow 0.1s;
}

.btn-icone:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 #94A3B8;
}

.barra-progresso-sessao {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #FEF3C7;
  border: 2px solid #FCD34D;
  padding: 6px 14px;
  border-radius: 20px;
}

.estrela-sessao {
  font-size: 1.25rem;
  color: #CBD5E1;
  transition: transform 0.3s, color 0.3s;
}

.estrela-sessao.conquistada {
  color: #F59E0B;
  transform: scale(1.15);
  filter: drop-shadow(0 2px 4px rgba(245, 158, 11, 0.4));
}

.placar-estrelas-jogo {
  font-size: 1.1rem;
  font-weight: 800;
  color: #B45309;
  background: #FEF3C7;
  border: 2px solid #FCD34D;
  padding: 6px 14px;
  border-radius: 20px;
}

/* ================= Palco Principal da Palavra ================= */
.palco-jogo {
  width: 100%;
  max-width: 680px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  margin: 0 auto;
}

/* Card da Ilustração */
.card-figura {
  background: #FFFFFF;
  border: 4px solid #FCD34D;
  border-radius: 28px;
  padding: 16px 24px;
  box-shadow: var(--sombra-card);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  width: 100%;
}

.container-svg-palavra {
  width: 130px;
  height: 130px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #FFFBEB;
  border-radius: 20px;
  padding: 10px;
  border: 2px solid #FEF3C7;
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.container-svg-palavra.celebrando {
  animation: pularAlegria 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes pularAlegria {
  0%, 100% { transform: scale(1) translateY(0); }
  50% { transform: scale(1.18) translateY(-14px) rotate(4deg); }
}

.btn-ouvir-palavra {
  min-height: 50px;
  padding: 8px 20px;
  font-size: 1.1rem;
  font-weight: 800;
  font-family: inherit;
  background: #FEF08A;
  border: 3px solid #EAB308;
  border-radius: 26px;
  color: #854D0E;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 4px 0 #CA8A04;
}

.btn-ouvir-palavra:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 #CA8A04;
}

.instrucao-texto {
  font-size: 1.1rem;
  font-weight: 800;
  color: #B45309;
  min-height: 26px;
  text-align: center;
}

/* ================= Área de Slots da Palavra ================= */
.area-slots {
  background: #FFFFFF;
  border: 4px solid #60A5FA;
  border-radius: 24px;
  padding: 18px 24px;
  box-shadow: var(--sombra-card);
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.rotulo-slots {
  font-size: 0.95rem;
  font-weight: 800;
  color: #1E40AF;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.linha-slots {
  display: flex;
  gap: 14px;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
}

.slot-alvo {
  min-width: 82px;
  min-height: 82px;
  border-radius: 22px;
  border: 4px dashed #93C5FD;
  background: #EFF6FF;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.slot-alvo.drag-over {
  border-color: #2563EB;
  background: #DBEAFE;
  transform: scale(1.08);
}

.slot-alvo .numero-ordem {
  position: absolute;
  top: 4px;
  left: 8px;
  font-size: 0.85rem;
  font-weight: 800;
  color: #93C5FD;
}

.slot-alvo.ocupado {
  border-style: solid;
  border-color: #3B82F6;
  background: #FFFFFF;
  box-shadow: 0 6px 0 #1D4ED8;
  transform: scale(1.02);
}

.slot-alvo.acerto-completo {
  border-color: #10B981;
  background: #ECFDF5;
  box-shadow: 0 6px 0 #047857;
  animation: brilhoAcerto 0.8s alternate infinite;
}

@keyframes brilhoAcerto {
  from { box-shadow: 0 0 10px #10B981, 0 6px 0 #047857; }
  to { box-shadow: 0 0 24px #10B981, 0 6px 0 #047857; }
}

.slot-alvo.balanco-erro {
  animation: balancoErro 0.45s ease;
  border-color: #F87171;
  background: #FEF2F2;
}

@keyframes balancoErro {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-8px) rotate(-3deg); }
  75% { transform: translateX(8px) rotate(3deg); }
}

.texto-silaba-slot {
  font-size: 2.2rem;
  font-weight: 900;
  color: #1E3A8A;
}

/* ================= Bandeja de Sílabas (Peças para montar) ================= */
.area-bandeja {
  background: #FFFFFF;
  border: 4px solid #FCD34D;
  border-radius: 24px;
  padding: 16px 20px;
  box-shadow: var(--sombra-card);
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.rotulo-bandeja {
  font-size: 0.95rem;
  font-weight: 800;
  color: #78350F;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.grade-bandeja {
  display: flex;
  gap: 14px;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  min-height: 84px;
}

/* Peça/Bloco de Sílaba */
.bloco-silaba {
  min-width: 82px;
  min-height: 82px;
  padding: 10px;
  border-radius: 22px;
  border: 4px solid #F59E0B;
  background: linear-gradient(180deg, #FEF08A 0%, #FDE047 100%);
  color: #713F12;
  font-family: inherit;
  font-size: 2.2rem;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: grab;
  box-shadow: 0 6px 0 #CA8A04, 0 8px 14px rgba(0, 0, 0, 0.08);
  position: relative;
  transition: transform 0.15s, box-shadow 0.15s;
}

.bloco-silaba:active {
  cursor: grabbing;
  transform: translateY(4px);
  box-shadow: 0 2px 0 #CA8A04;
}

.bloco-silaba.em-arrasto {
  opacity: 0.5;
  transform: scale(0.95);
}

.bloco-silaba.dica-ajuda {
  animation: pulsarDicaAjuda 1s infinite alternate;
  border-color: #2563EB;
}

@keyframes pulsarDicaAjuda {
  from { box-shadow: 0 0 6px #2563EB, 0 6px 0 #CA8A04; }
  to { box-shadow: 0 0 20px #2563EB, 0 6px 0 #2563EB; transform: scale(1.06); }
}

/* ================= Modal de Vitória da Sessão ================= */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 1000;
  backdrop-filter: blur(4px);
}

.modal-vitoria {
  background: #FFFFFF;
  border: 6px solid #F59E0B;
  border-radius: 32px;
  padding: 28px 24px;
  max-width: 440px;
  width: 100%;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
  animation: zoomModal 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes zoomModal {
  0% { transform: scale(0.6); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.banner-vitoria {
  font-size: 2.6rem;
  font-weight: 900;
  color: #D97706;
  text-shadow: 2px 2px 0 #FEF08A;
}

.trofeu-container {
  width: 90px;
  height: 90px;
  filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.15));
}

.msg-vitoria {
  font-size: 1.25rem;
  font-weight: 800;
  color: #1E293B;
  line-height: 1.35;
}

.acoes-vitoria {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  margin-top: 8px;
}

.btn-nova-sessao {
  min-height: 64px;
  padding: 14px 28px;
  font-size: 1.35rem;
  font-weight: 800;
  font-family: inherit;
  color: #FFFFFF;
  background: linear-gradient(180deg, #F59E0B 0%, #D97706 100%);
  border: 4px solid #78350F;
  border-radius: 30px;
  box-shadow: 0 6px 0 #78350F;
  cursor: pointer;
}

.btn-nova-sessao:active {
  transform: translateY(4px);
  box-shadow: 0 2px 0 #78350F;
}

.btn-voltar-inicio {
  min-height: 52px;
  padding: 10px 20px;
  font-size: 1.1rem;
  font-weight: 800;
  font-family: inherit;
  color: #475569;
  background: #F1F5F9;
  border: 3px solid #CBD5E1;
  border-radius: 26px;
  cursor: pointer;
}

/* Canvas de Confete */
#canvas-confete {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1001;
}

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

/* Otimizações responsivas para telas compactas de celular (ex: 390px) */
@media (max-width: 600px) {
  .tela {
    padding: 8px;
  }
  .cabecalho-jogo {
    margin-bottom: 6px;
    padding: 2px 0;
  }
  .btn-icone {
    min-width: 44px;
    min-height: 44px;
    font-size: 1.15rem;
  }
  .barra-progresso-sessao {
    padding: 4px 10px;
    gap: 4px;
  }
  .estrela-sessao {
    font-size: 1.05rem;
  }
  .placar-estrelas-jogo {
    padding: 4px 10px;
    font-size: 0.95rem;
  }
  .palco-jogo {
    gap: 10px;
  }
  .card-figura {
    padding: 10px 14px;
    gap: 8px;
    border-radius: 20px;
  }
  .container-svg-palavra {
    width: 96px;
    height: 96px;
    padding: 6px;
  }
  .btn-ouvir-palavra {
    min-height: 44px;
    padding: 6px 14px;
    font-size: 0.95rem;
  }
  .instrucao-texto {
    font-size: 0.95rem;
    min-height: 20px;
  }
  .area-slots {
    padding: 12px 14px;
    gap: 8px;
    border-radius: 20px;
  }
  .linha-slots {
    gap: 8px;
  }
  .slot-alvo {
    min-width: 68px;
    min-height: 68px;
    border-radius: 16px;
    border-width: 3px;
  }
  .texto-silaba-slot {
    font-size: 1.8rem;
  }
  .area-bandeja {
    padding: 12px 14px;
    gap: 8px;
    border-radius: 20px;
  }
  .grade-bandeja {
    gap: 8px;
    min-height: 70px;
  }
  .bloco-silaba {
    min-width: 68px;
    min-height: 68px;
    font-size: 1.8rem;
    border-radius: 16px;
    border-width: 3px;
    box-shadow: 0 4px 0 #CA8A04;
  }
}
