/* =========================================================
   App da Júlia — Sílabas e Palavras
   Tema: animais fofinhos
   Considerações TEA:
   - Paleta pastel suave (não satura)
   - Animações lentas (250ms+) e nunca pulsando rápido
   - Sem flashes, sem cores piscando
   - Botões grandes (mínimo 64px de altura)
   - Foco e contraste claros, ícones consistentes
   - Estrutura visual previsível (sempre o mesmo lugar)
   ========================================================= */

:root{
  --bg:        #FFF7EE;     /* creme bem suave   */
  --bg-card:   #FFFFFF;
  --primary:   #7FB3D5;     /* azul pastel       */
  --primary-d: #5A9BC4;
  --accent:    #F5B7B1;     /* rosa suave        */
  --accent-2:  #ABEBC6;     /* verde menta       */
  --yellow:    #FAD7A0;     /* amarelo creme     */
  --text:      #34495E;     /* azul-cinza escuro */
  --text-soft: #7F8C8D;
  --shadow:    0 4px 14px rgba(52,73,94,.08);
  --radius:    18px;
  --font:      'Nunito', 'Segoe UI', system-ui, -apple-system, sans-serif;
}

*{ box-sizing: border-box; }

html, body{
  margin:0; padding:0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

/* ============== TOPO ============== */
header.topo{
  display:flex; align-items:center; justify-content:space-between;
  padding: 14px 22px;
  background: var(--bg-card);
  box-shadow: var(--shadow);
  position: sticky; top:0; z-index: 10;
}
header.topo .mascote{ font-size: 36px; }
header.topo h1{
  margin: 0;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: .3px;
}
header.topo .estrelas{
  background: var(--yellow);
  padding: 8px 16px;
  border-radius: 999px;
  font-weight: 800;
  font-size: 18px;
}

/* ============== CONTAINER ============== */
main{
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px 18px 80px;
}

.tela{ display:none; }
.tela.ativa{ display:block; animation: aparecer .35s ease both; }
@keyframes aparecer{
  from{ opacity:0; transform: translateY(8px); }
  to  { opacity:1; transform: translateY(0); }
}

/* ============== MENU ============== */
.saudacao{
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow);
  text-align: center;
  margin-bottom: 22px;
}
.saudacao .ola{ font-size: 64px; margin-bottom: 6px; }
.saudacao h2{ margin: 4px 0; font-size: 28px; }
.saudacao p{ color: var(--text-soft); margin: 4px 0 0; }

.menu-grid{
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 18px;
}
.btn-atividade{
  background: var(--bg-card);
  border: 3px solid transparent;
  border-radius: var(--radius);
  padding: 24px 18px;
  font-family: var(--font);
  font-size: 18px;
  font-weight: 800;
  color: var(--text);
  cursor: pointer;
  text-align: center;
  box-shadow: var(--shadow);
  transition: transform .25s ease, border-color .25s ease;
}
.btn-atividade .icone{ display:block; font-size: 56px; margin-bottom: 10px; }
.btn-atividade .desc{ display:block; font-weight: 500; font-size: 14px; color: var(--text-soft); margin-top: 6px; }
.btn-atividade:hover, .btn-atividade:focus{
  transform: translateY(-3px);
  border-color: var(--primary);
  outline: none;
}
.btn-atividade.c1{ background: #EAF4FB; }
.btn-atividade.c2{ background: #FBEAEA; }
.btn-atividade.c3{ background: #EAF8EF; }
.btn-atividade.c4{ background: #FBF1E0; }

/* ============== BARRA DE NAVEGAÇÃO ============== */
.barra-nav{
  display:flex; align-items:center; justify-content: space-between;
  margin-bottom: 18px;
}
.btn-voltar{
  background: var(--bg-card);
  border: none;
  border-radius: 999px;
  padding: 12px 20px;
  font-family: var(--font);
  font-weight: 800;
  font-size: 16px;
  color: var(--text);
  box-shadow: var(--shadow);
  cursor: pointer;
}
.titulo-tela{
  font-size: 22px; font-weight: 800; margin: 0;
}

/* ============== TABELA DE SÍLABAS ============== */
.tabela-silabas{
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
  overflow-x: auto;
}
.linha-silabas{
  display: grid;
  grid-template-columns: 60px repeat(5, 1fr);
  gap: 8px;
  margin-bottom: 8px;
}
.linha-silabas:last-child{ margin-bottom: 0; }
.cab-letra{
  display:flex; align-items:center; justify-content:center;
  background: var(--primary);
  color: white;
  font-weight: 800;
  font-size: 22px;
  border-radius: 12px;
}
.celula-silaba{
  background: #F8F9FA;
  border: 2px solid transparent;
  border-radius: 12px;
  padding: 14px 6px;
  font-size: 22px;
  font-weight: 800;
  cursor: pointer;
  transition: background .25s ease, transform .15s ease, border-color .25s ease;
  min-height: 60px;
  display:flex; align-items:center; justify-content:center;
}
.celula-silaba:hover{ background: #E3F2FD; border-color: var(--primary); }
.celula-silaba.tocando{ background: var(--accent-2); border-color: #2ECC71; transform: scale(.96); }
.celula-silaba.vazia{ visibility: hidden; }

.dica{
  background: var(--yellow);
  border-radius: 12px;
  padding: 12px 16px;
  margin-top: 14px;
  font-size: 15px;
  color: var(--text);
}

/* ============== FORMAR PALAVRAS ============== */
.palco-palavra{
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow);
  text-align: center;
  margin-bottom: 18px;
}
.palco-palavra .emoji-grande{ font-size: 140px; line-height:1; margin-bottom: 8px; }
.palco-palavra .nome-palavra{ font-size: 18px; color: var(--text-soft); margin: 0 0 14px; }
.btn-ouvir{
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 999px;
  padding: 14px 28px;
  font-family: var(--font);
  font-weight: 800;
  font-size: 16px;
  cursor: pointer;
  box-shadow: var(--shadow);
}
.btn-ouvir:hover{ background: var(--primary-d); }

.alvos{
  display:flex; justify-content:center; flex-wrap: wrap; gap: 12px;
  margin: 24px 0;
}
.alvo-silaba{
  width: 110px; height: 80px;
  border: 3px dashed var(--primary);
  border-radius: 14px;
  background: #F8FBFD;
  display:flex; align-items:center; justify-content:center;
  font-size: 28px; font-weight: 800;
  color: var(--text);
  transition: background .25s ease, border-color .25s ease;
}
.alvo-silaba.over{ background: #DCEEFB; }
.alvo-silaba.ok{
  background: var(--accent-2);
  border-style: solid;
  border-color: #2ECC71;
}
/* Modelo livre: peça colocada (ainda não verificada) */
.alvo-silaba.preenchido{
  background: #EAF4FB;
  border-style: solid;
  border-color: var(--primary);
}
/* Verificado: tudo certo */
.alvo-silaba.correto{
  background: var(--accent-2);
  border-style: solid;
  border-color: #2ECC71;
  animation: pulsoCerto .5s ease;
}
@keyframes pulsoCerto{
  0%   { transform: scale(1); }
  50%  { transform: scale(1.06); }
  100% { transform: scale(1); }
}
/* Verificado: errado — só marca, não pisca alto */
.alvo-silaba.errado{
  background: #FBEAEA;
  border-style: solid;
  border-color: #E69999;
}

.pecas{
  display:flex; justify-content:center; flex-wrap: wrap; gap: 12px;
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
  min-height: 100px;
}
.peca-silaba{
  background: var(--accent);
  border: none;
  border-radius: 14px;
  padding: 16px 22px;
  font-size: 26px;
  font-weight: 800;
  color: var(--text);
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: transform .15s ease, opacity .25s ease, background .25s ease;
}
.peca-silaba:active{ transform: scale(.96); }
.peca-silaba.usada{ opacity: 0; pointer-events: none; }

/* ============== QUIZ / DITADO ============== */
.cartao-quiz{
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow);
  text-align: center;
}
.cartao-quiz .pergunta{ font-size: 18px; color: var(--text-soft); margin: 0 0 14px; }
.cartao-quiz .btn-ouvir{ margin-bottom: 22px; }

.opcoes{
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  max-width: 600px;
  margin: 0 auto;
}
.opcao{
  background: #F8F9FA;
  border: 3px solid transparent;
  border-radius: 14px;
  padding: 18px;
  font-family: var(--font);
  font-size: 24px;
  font-weight: 800;
  color: var(--text);
  cursor: pointer;
  transition: background .25s ease, border-color .25s ease, transform .15s ease;
}
.opcao:hover{ background: #E3F2FD; border-color: var(--primary); }
.opcao.certa{ background: var(--accent-2); border-color: #2ECC71; }
.opcao.errada{ background: #FBEAEA; border-color: var(--accent); }

/* ============== DITADO ============== */
.ditado-area{ margin-top: 18px; }
.ditado-resposta{
  display:flex; justify-content:center; gap: 8px;
  margin: 16px 0;
  min-height: 80px;
  flex-wrap: wrap;
}
.slot-resp{
  min-width: 90px; height: 80px;
  border: 3px dashed var(--primary);
  border-radius: 14px;
  background: #F8FBFD;
  display:flex; align-items:center; justify-content:center;
  font-size: 26px; font-weight: 800;
  cursor: pointer;
}
.slot-resp.preenchido{
  background: var(--accent-2);
  border-style: solid;
  border-color: #2ECC71;
}

.banco-silabas{
  display:flex; justify-content:center; flex-wrap: wrap; gap: 10px;
  margin-top: 18px;
}
.banco-silabas .peca-silaba{ background: var(--yellow); font-size: 22px; padding: 14px 18px; }

/* ============== FEEDBACK POSITIVO ============== */
.feedback{
  position: fixed; inset: 0;
  display:flex; align-items:center; justify-content:center;
  background: rgba(52,73,94,.35);
  z-index: 50;
  opacity: 0; pointer-events: none;
  transition: opacity .25s ease;
}
.feedback.show{ opacity: 1; pointer-events: auto; }
.feedback .caixa{
  background: white;
  border-radius: var(--radius);
  padding: 32px 36px;
  text-align: center;
  box-shadow: 0 10px 30px rgba(52,73,94,.2);
  max-width: 380px;
}
.feedback .caixa .icone{ font-size: 72px; margin-bottom: 8px; }
.feedback .caixa h3{ margin: 4px 0 6px; font-size: 24px; }
.feedback .caixa p{ margin: 4px 0 18px; color: var(--text-soft); }
.feedback .caixa button{
  background: var(--primary);
  color: white; border: none;
  border-radius: 999px;
  padding: 12px 24px;
  font-family: var(--font);
  font-weight: 800; font-size: 16px;
  cursor: pointer;
}

/* ============== RODAPÉ DA TAREFA ============== */
.rodape-tarefa{
  display:flex; justify-content:space-between; align-items:center;
  margin-top: 22px;
  padding: 14px 18px;
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.rodape-tarefa .progresso{
  font-weight: 800;
  color: var(--text-soft);
}
.btn-acao{
  background: var(--accent-2);
  border: none; border-radius: 999px;
  padding: 12px 22px;
  font-family: var(--font);
  font-weight: 800; font-size: 16px;
  color: var(--text);
  cursor: pointer;
  box-shadow: var(--shadow);
}
.btn-acao.secundario{ background: #ECF0F1; }

/* ============== RESPONSIVO ============== */
@media (max-width: 600px){
  .saudacao .ola{ font-size: 52px; }
  .saudacao h2{ font-size: 22px; }
  .palco-palavra .emoji-grande{ font-size: 100px; }
  .linha-silabas{ grid-template-columns: 50px repeat(5, 1fr); gap: 6px; }
  .celula-silaba{ font-size: 18px; padding: 12px 4px; }
  .cab-letra{ font-size: 18px; }
  .alvo-silaba{ width: 90px; height: 70px; font-size: 22px; }
  .peca-silaba{ font-size: 22px; padding: 12px 18px; }
}

/* foco visível para acessibilidade */
button:focus-visible, [tabindex]:focus-visible{
  outline: 3px solid var(--primary);
  outline-offset: 2px;
}

/* ============== SELETOR DE NÍVEL ============== */
.seletor-nivel{
  display:flex; gap: 8px; justify-content: center;
  margin: 0 0 18px;
  flex-wrap: wrap;
}
.btn-nivel{
  background: var(--bg-card);
  border: 2px solid transparent;
  border-radius: 999px;
  padding: 10px 18px;
  font-family: var(--font);
  font-weight: 800;
  font-size: 15px;
  color: var(--text);
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: background .25s ease, border-color .25s ease;
}
.btn-nivel.ativo{
  background: var(--primary);
  color: white;
  border-color: var(--primary-d);
}
.btn-nivel small{
  display:block;
  font-weight: 500;
  font-size: 11px;
  opacity: .8;
  margin-top: 2px;
}

/* peça selecionada (modo tap-to-fill) */
.peca-silaba.selecionada{
  background: var(--primary);
  color: white;
  transform: scale(1.05);
}

/* botão de feedback "próxima" mais destacado */
.feedback .caixa button.proxima{
  background: var(--accent-2);
  color: var(--text);
}
.feedback .caixa .botoes{
  display:flex; gap: 10px; justify-content: center; flex-wrap: wrap;
}
.feedback .caixa .botoes button{ margin: 0; }

/* sub-título das tabelas */
.sub-titulo{
  font-size: 16px;
  font-weight: 800;
  color: var(--text-soft);
  margin: 0 0 10px 4px;
  text-transform: uppercase;
  letter-spacing: .5px;
}

/* cabeçalho de letra clicável (lê toda a linha) */
.cab-letra{
  cursor: pointer;
  transition: transform .15s ease, background .25s ease;
}
.cab-letra:hover{ background: var(--primary-d); }
.cab-letra.tocando{ transform: scale(0.95); background: var(--accent-2); color: var(--text); }

/* drag-and-drop: peça sendo arrastada (ghost) */
.peca-silaba{
  cursor: grab;
  touch-action: none;     /* essencial para pointer events em mobile */
  user-select: none;
  -webkit-user-select: none;
}
.peca-silaba:active{ cursor: grabbing; }

/* alvo destacado quando há peça por cima (drag-over) */
.alvo-silaba.hover{
  background: #DCEEFB;
  border-color: var(--primary-d);
  border-style: solid;
  transform: scale(1.05);
}

/* linhas da tabela ajustadas pra sílabas mais longas (CLAS, BRAS, etc) */
.tabela-silabas .celula-silaba{ font-size: 18px; padding: 12px 4px; }
.tabela-silabas .cab-letra{ font-size: 16px; }
