/* Mundo Buinho — identidade Buinho EDUCATIVO
   Buinho FabLab, Messejana · CC-BY-SA 4.0
   ⚠️ Paleta Educativo (creme/azul/laranja). NUNCA misturar com a Main. */

:root {
  --creme: #FAF0E1;
  --creme-escuro: #EADFCB;
  --castanho-claro: #C3BAA3;
  --castanho: #8A8578;
  --castanho-2: #9A927F;
  --azul: #2038A6;
  --azul-fundo: #16296f;
  --laranja: #FA6415;
  --laranja-fundo: #b23c0a;
  --verde: #6B8F3E;
  --verde-fundo: #55722f;
  --tinta: #22201C;
}

/* Fontes locais — escolas do Alentejo nem sempre têm boa rede (spec §4) */
@font-face {
  font-family: 'Fredoka';
  src: url('../fonts/Fredoka-Variable.woff2') format('woff2-variations');
  font-weight: 300 700;
  font-display: swap;
}
@font-face {
  font-family: 'Nunito';
  src: url('../fonts/Nunito-Variable.woff2') format('woff2-variations');
  font-weight: 200 1000;
  font-display: swap;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  font-family: 'Nunito', system-ui, -apple-system, sans-serif;
  color: var(--tinta);
  overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  background:
    radial-gradient(circle at 12% 16%, rgba(46,91,230,.16), transparent 34%),
    radial-gradient(circle at 90% 10%, rgba(250,100,21,.15), transparent 32%),
    radial-gradient(circle at 84% 84%, rgba(63,163,77,.15), transparent 36%),
    radial-gradient(circle at 16% 90%, rgba(246,185,59,.18), transparent 36%),
    var(--creme);
  background-attachment: fixed;
}

button {
  font-family: inherit;
  border: none;
  cursor: pointer;
  background: none;
  color: inherit;
}

/* ---------- Animações (transcritas do protótipo) ---------- */
@keyframes buPop    { 0%{transform:scale(.6);opacity:0} 60%{transform:scale(1.12)} 100%{transform:scale(1);opacity:1} }
@keyframes buFloat  { 0%,100%{transform:translateY(0)} 50%{transform:translateY(-7px)} }
@keyframes buWiggle { 0%,100%{transform:rotate(-3deg)} 50%{transform:rotate(3deg)} }
@keyframes buFall   { 0%{transform:translateY(-20px) rotate(0);opacity:1} 100%{transform:translateY(560px) rotate(540deg);opacity:0} }
@keyframes buPulse  { 0%,100%{transform:scale(1)} 50%{transform:scale(1.06)} }
@keyframes buDots   { 0%,80%,100%{opacity:.25} 40%{opacity:1} }
@keyframes buRise   { from{transform:translateY(24px);opacity:0} to{transform:translateY(0);opacity:1} }
@keyframes buSpin   { to{transform:rotate(360deg)} }

/* Respeitar quem prefere menos movimento */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001s !important;
    transition-duration: .001s !important;
  }
}

/* ---------- Estrutura ---------- */
.app {
  max-width: 820px;
  margin: 0 auto;
  min-height: 100%;
  position: relative;
  padding-bottom: 40px;
}

.ecra { animation: buRise .35s ease both; }
.escondido { display: none !important; }

/* ---------- Barra de topo ---------- */
.topo {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 18px 8px;
}

.topo-titulo {
  font-family: 'Fredoka', sans-serif;
  font-weight: 700;
  font-size: 25px;
  margin: 0;
  flex: 1;
  line-height: 1.1;
}

.topo-sub {
  font-size: 13px;
  font-weight: 700;
  color: var(--castanho);
  margin: 2px 0 0;
}

.btn-redondo {
  width: 52px;
  height: 52px;
  flex: none;
  border-radius: 50%;
  background: var(--creme);
  box-shadow: 0 4px 0 var(--castanho-claro);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
}
.btn-redondo:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--castanho-claro); }

.avatar {
  width: 50px; height: 50px; flex: none;
  border-radius: 50%;
  background: var(--creme);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 0 var(--castanho-claro);
}

/* ---------- Mapa de níveis ---------- */
.mapa {
  position: relative;
  height: 900px;
  margin-top: 8px;
}

.mapa-mascote {
  position: absolute;
  left: 50%; top: 62px;
  transform: translate(-50%,-50%);
  display: flex; flex-direction: column; align-items: center; gap: 7px;
  pointer-events: none;
  text-align: center;
}

.mascote-bolha {
  width: 76px; height: 76px;
  border-radius: 50%;
  background: var(--creme);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 5px 0 rgba(0,0,0,.12);
  animation: buFloat 3s ease-in-out infinite;
}

.mapa-legenda {
  font-family: 'Fredoka', sans-serif;
  font-weight: 600;
  font-size: 15px;
  color: var(--castanho);
  background: rgba(250,240,225,.75);
  padding: 4px 14px;
  border-radius: 999px;
}

.nivel {
  position: absolute;
  transform: translate(-50%,-50%);
  width: 172px;
  display: flex; flex-direction: column; align-items: center; gap: 9px;
  padding: 0;
}
.nivel:active { transform: translate(-50%,-50%) translateY(4px); }

.nivel-bola {
  position: relative;
  width: 104px; height: 104px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 46px;
  box-shadow: 0 9px 0 var(--sombra), 0 16px 26px rgba(34,32,28,.22);
  background: var(--cor);
}

.nivel-num {
  position: absolute;
  top: -6px; left: -6px;
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--creme);
  color: var(--sombra);
  font-family: 'Fredoka', sans-serif;
  font-weight: 700; font-size: 17px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 3px 0 var(--castanho-claro);
}

.nivel-nome {
  font-family: 'Fredoka', sans-serif;
  font-weight: 600;
  font-size: 17px;
  text-align: center;
  line-height: 1.15;
}

.nivel-tema {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--castanho);
  text-align: center;
}

/* Trilho pontilhado entre níveis */
.trilho {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: -1;
}

/* ---------- Cartões de jogo ---------- */
.painel {
  background: rgba(250,240,225,.92);
  border-radius: 26px;
  margin: 10px 16px;
  padding: 20px 18px;
  box-shadow: 0 6px 0 var(--creme-escuro);
}

.enunciado {
  font-family: 'Fredoka', sans-serif;
  font-weight: 600;
  font-size: 20px;
  line-height: 1.3;
  margin: 0 0 16px;
  text-align: center;
}

/* Alvos de toque ≥44px (spec §5) */
.alvo { min-height: 58px; min-width: 58px; }

.chip {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 12px;
  border-radius: 16px;
  min-height: 58px;
  background: var(--creme);
  box-shadow: 0 4px 0 var(--castanho-claro);
  color: var(--tinta);
  font-weight: 700;
  touch-action: none;
}
.chip.feito {
  background: #e7efd9;
  box-shadow: inset 0 0 0 2px var(--verde);
  opacity: .75;
}

.slot {
  min-height: 74px;
  border-radius: 18px;
  border: 3px dashed var(--castanho-claro);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800;
  color: var(--castanho);
  background: rgba(255,255,255,.35);
}
.slot.cheio {
  border-style: solid;
  border-color: var(--verde);
  background: #e7efd9;
  color: var(--tinta);
}

.grelha { display: grid; gap: 10px; }
.grelha-2 { grid-template-columns: 1fr 1fr; }
.grelha-4 { grid-template-columns: repeat(4, 1fr); }

/* ---------- Botões grandes ---------- */
.botao {
  height: 70px;
  border-radius: 20px;
  font-family: 'Fredoka', sans-serif;
  font-weight: 800;
  font-size: 28px;
  background: var(--azul);
  color: #fff;
  box-shadow: 0 5px 0 var(--azul-fundo);
  width: 100%;
}
.botao:active { transform: translateY(3px); box-shadow: 0 2px 0 var(--azul-fundo); }
.botao.errado {
  background: var(--laranja);
  box-shadow: 0 5px 0 var(--laranja-fundo);
  animation: buWiggle .3s ease;
}
.botao.verde { background: var(--verde); box-shadow: 0 5px 0 var(--verde-fundo); }
.botao.laranja { background: var(--laranja); box-shadow: 0 5px 0 var(--laranja-fundo); }

.botao-pequeno {
  height: 52px;
  border-radius: 16px;
  font-family: 'Fredoka', sans-serif;
  font-weight: 700;
  font-size: 17px;
  padding: 0 20px;
  background: var(--creme);
  box-shadow: 0 4px 0 var(--castanho-claro);
}
.botao-pequeno:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--castanho-claro); }

/* ---------- Progresso ---------- */
.pontos { display: flex; gap: 6px; justify-content: center; margin-top: 16px; }
.ponto {
  width: 10px; height: 10px;
  border-radius: 5px;
  background: var(--castanho-claro);
  transition: all .3s;
}
.ponto.feito { background: var(--verde); }
.ponto.actual { width: 26px; background: var(--laranja); }

/* ---------- Mascote / balão ---------- */
.mascote-painel {
  position: fixed;
  left: 50%; bottom: 20px;
  transform: translateX(-50%);
  width: min(560px, calc(100% - 32px));
  background: var(--creme);
  border-radius: 24px;
  padding: 16px 18px;
  box-shadow: 0 8px 0 var(--castanho-claro), 0 18px 40px rgba(34,32,28,.25);
  display: flex; gap: 14px; align-items: flex-start;
  animation: buRise .3s ease both;
  z-index: 50;
}

.mascote-texto {
  flex: 1;
  font-size: 16.5px;
  font-weight: 700;
  line-height: 1.45;
}

.pontinhos { display: flex; gap: 5px; padding-top: 8px; }
.pontinhos span {
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--azul);
  animation: buDots 1.2s infinite;
}
.pontinhos span:nth-child(2) { animation-delay: .15s; }
.pontinhos span:nth-child(3) { animation-delay: .3s; }

/* ---------- Celebração ---------- */
.celebracao {
  position: fixed; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  pointer-events: none;
  z-index: 60;
}
.celebracao-emoji { font-size: 92px; animation: buPop .4s ease both; }
.celebracao-texto {
  font-family: 'Fredoka', sans-serif;
  font-weight: 700; font-size: 30px;
  color: var(--tinta);
  background: var(--creme);
  padding: 10px 26px;
  border-radius: 999px;
  box-shadow: 0 6px 0 var(--castanho-claro);
  animation: buPop .4s ease .08s both;
}
.confete {
  position: absolute; top: -20px;
  border-radius: 3px;
}

/* ---------- Fantasma de arrasto ---------- */
.fantasma {
  position: fixed;
  z-index: 100;
  pointer-events: none;
  transform: translate(-50%,-50%) scale(1.08);
  display: flex; align-items: center; gap: 8px;
  padding: 12px 16px;
  border-radius: 16px;
  font-weight: 800;
  color: #fff;
  box-shadow: 0 10px 24px rgba(34,32,28,.35);
}

/* ---------- Canvas de desenho ---------- */
.tela {
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: 20px;
  background: #fff;
  box-shadow: inset 0 0 0 3px var(--creme-escuro);
  touch-action: none;   /* essencial: senão o dedo faz scroll em vez de desenhar */
  display: block;
}

.paleta { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; margin-top: 14px; }
.cor {
  width: 46px; height: 46px;
  border-radius: 50%;
  box-shadow: 0 3px 0 rgba(0,0,0,.18);
}
.cor.activa { outline: 4px solid var(--laranja); outline-offset: 2px; }

.espessura {
  width: 50px; height: 50px;
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  background: var(--creme-escuro);
  box-shadow: 0 3px 0 var(--castanho-claro);
}
.espessura.activa { outline: 3px solid var(--azul); outline-offset: 1px; }
.espessura i { display: block; border-radius: 50%; background: var(--tinta); }

/* ---------- Tablet / telemóvel ---------- */
@media (max-width: 860px) {
  .mapa { height: 820px; }
  .nivel { width: 140px; }
  .nivel-bola { width: 88px; height: 88px; font-size: 38px; }
}

@media (max-width: 560px) {
  .topo-titulo { font-size: 21px; }
  .mapa { height: 760px; }
  .nivel { width: 116px; }
  .nivel-bola { width: 74px; height: 74px; font-size: 32px; }
  .nivel-nome { font-size: 15px; }
  .nivel-tema { display: none; }
  .botao { height: 62px; font-size: 24px; }
  .grelha-4 { grid-template-columns: repeat(2, 1fr); }
}

/* Landscape em tablet: o mapa encolhe para caber sem scroll */
@media (max-height: 620px) and (orientation: landscape) {
  .nivel-bola { width: 76px; height: 76px; font-size: 32px; }
  .mapa-mascote { display: none; }
}
/* NB: a altura do .mapa é definida inline (10 níveis ~2160px) e não deve ser
   encurtada pelas media queries — senão os últimos jogos ficam cortados. */

/* ======================================================================
   JOGOS DE MATEMÁTICA (6–10) — mesma identidade Buinho Educativo
   ====================================================================== */

/* Contador / texto de apoio partilhado */
.contador {
  text-align: center;
  font-family: 'Fredoka', sans-serif;
  font-weight: 600;
  font-size: 16px;
  color: var(--castanho);
  margin: 14px 0;
}

/* ---------- Jogo 6 — Fatias Certas (frações) ---------- */
.fracao-alvo {
  font-family: 'Fredoka', sans-serif;
  font-weight: 700;
  font-size: 40px;
  color: var(--azul);
  text-align: center;
  margin: 4px 0 16px;
}
.barra-fatias {
  display: grid;
  gap: 6px;
  margin: 0 auto 4px;
  max-width: 480px;
}
.fatia {
  height: 84px;
  border-radius: 12px;
  background: var(--creme);
  box-shadow: inset 0 0 0 3px var(--creme-escuro);
  transition: background .18s, box-shadow .18s, transform .1s;
}
.fatia.pintada {
  background: linear-gradient(180deg, #7aa049, var(--verde));
  box-shadow: inset 0 0 0 3px var(--verde-fundo);
}
.fatia:active { transform: scale(.96); }

/* ---------- Jogo 7 — A Feira (dinheiro/decimais) ---------- */
.carteira {
  text-align: center;
  font-family: 'Fredoka', sans-serif;
  font-size: 18px;
  background: var(--creme);
  border-radius: 14px;
  padding: 10px;
  box-shadow: 0 4px 0 var(--creme-escuro);
  margin-bottom: 16px;
}
.moedas {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
}
.moeda {
  width: 74px; height: 74px;
  border-radius: 50%;
  font-family: 'Fredoka', sans-serif;
  font-weight: 700;
  font-size: 15px;
  color: var(--tinta);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 5px 0 rgba(0,0,0,.22);
  transition: transform .1s, outline-color .15s;
}
.moeda.ouro  { background: radial-gradient(circle at 35% 30%, #ffe29a, #f6b93b); }
.moeda.prata { background: radial-gradient(circle at 35% 30%, #f2f2f2, #c9cdd4); }
.moeda.escolhida { outline: 4px solid var(--laranja); outline-offset: 3px; transform: translateY(4px); }
.moeda:active { transform: translateY(4px); }

/* ---------- Jogo 8 — A Horta Cercada (perímetro) ---------- */
.horta-svg {
  height: auto;
  margin: 6px 0 2px;
  touch-action: manipulation;
}

/* ---------- Jogo 9 — Castelos na Areia (sequências) ---------- */
.castelos {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 12px;
  min-height: 160px;
  margin-bottom: 18px;
  padding: 0 4px;
}
.castelo-col { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.castelo-bar {
  width: 46px;
  border-radius: 8px 8px 0 0;
  background: linear-gradient(180deg, #4a63c8, var(--azul));
  box-shadow: inset 0 -4px 0 var(--azul-fundo);
  animation: buRise .35s ease both;
}
.castelo-bar.incognita {
  background: repeating-linear-gradient(45deg, var(--creme-escuro), var(--creme-escuro) 6px, var(--creme) 6px, var(--creme) 12px);
  box-shadow: inset 0 0 0 3px var(--castanho-claro);
  color: var(--castanho);
  font-family: 'Fredoka', sans-serif;
  font-weight: 700;
  font-size: 26px;
  display: flex; align-items: center; justify-content: center;
}
.castelo-rot {
  font-family: 'Fredoka', sans-serif;
  font-weight: 700;
  font-size: 18px;
  color: var(--tinta);
}

/* ---------- Jogo 10 — O Gráfico da Turma (gráficos) ---------- */
.graf-titulo {
  font-family: 'Fredoka', sans-serif;
  font-weight: 600;
  font-size: 18px;
  text-align: center;
  margin: 0 0 14px;
}
.graf-titulo span { color: var(--castanho); font-size: 15px; }
.grafico {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 14px;
  min-height: 168px;
  margin-bottom: 12px;
  padding: 0 4px;
}
.graf-col { display: flex; flex-direction: column; align-items: center; gap: 6px; flex: 1; max-width: 84px; }
.graf-val { font-family: 'Fredoka', sans-serif; font-weight: 700; font-size: 18px; }
.graf-bar {
  width: 100%;
  border-radius: 8px 8px 0 0;
  box-shadow: inset 0 -4px 0 rgba(0,0,0,.18);
  animation: buRise .4s ease both;
}
.graf-rot { font-size: 13.5px; font-weight: 700; color: var(--castanho); text-align: center; line-height: 1.1; }

/* ======================================================================
   JOGOS DE MATEMÁTICA — nível exigente (fração de quantidade, troco,
   área/perímetro, cronómetro, pictograma)
   ====================================================================== */

/* Fração como parte de uma fração inline no enunciado */
.fracao-inline {
  display: inline-block;
  font-family: 'Fredoka', sans-serif;
  font-weight: 700;
  color: var(--azul);
  background: rgba(32, 56, 166, .1);
  border-radius: 10px;
  padding: 0 8px;
}

/* Jogo 6 — cesto de frutos (apanhar a fração de uma quantidade) */
.cesto {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin: 6px 0 4px;
}
.fruto {
  width: 54px; height: 54px;
  border-radius: 14px;
  font-size: 30px;
  line-height: 1;
  background: var(--creme);
  box-shadow: 0 4px 0 var(--creme-escuro);
  display: flex; align-items: center; justify-content: center;
  filter: grayscale(.15) opacity(.9);
  transition: transform .1s, box-shadow .15s, filter .15s, background .15s;
}
.fruto.apanhado {
  background: #e7efd9;
  box-shadow: 0 4px 0 var(--verde-fundo), inset 0 0 0 3px var(--verde);
  filter: none;
  transform: translateY(2px) scale(1.03);
}
.fruto:active { transform: scale(.94); }

/* Jogo 7 — pergunta do troco */
.troco-pergunta { text-align: center; font-weight: 700; color: var(--castanho); margin: -6px 0 12px; }

/* Jogo 8 — medidas no SVG do retângulo */
.medida {
  font-family: 'Fredoka', sans-serif;
  font-weight: 700;
  font-size: 17px;
  fill: var(--tinta);
}
.medida-incognita { fill: var(--laranja); font-size: 22px; }

/* Cronómetro (jogos-quiz) */
.tempo {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 14px;
}
.tempo-icone { font-size: 20px; }
.tempo-fundo {
  flex: 1;
  height: 14px;
  border-radius: 999px;
  background: var(--creme-escuro);
  overflow: hidden;
  box-shadow: inset 0 1px 2px rgba(0,0,0,.12);
}
.tempo-barra {
  height: 100%;
  border-radius: 999px;
  background: var(--verde);
  transition: width .12s linear, background .3s;
}
.tempo-num {
  font-family: 'Fredoka', sans-serif;
  font-weight: 700;
  font-size: 16px;
  color: var(--castanho);
  min-width: 38px;
  text-align: right;
}

/* Jogo 10 — pictograma (cada símbolo vale N; ler a escala é o desafio) */
.pictograma {
  display: flex; flex-direction: column; gap: 10px;
  margin: 6px 0 14px;
  padding: 12px;
  background: rgba(255,255,255,.4);
  border-radius: 16px;
}
.pic-linha { display: flex; align-items: center; gap: 10px; }
.pic-rot {
  min-width: 76px;
  font-family: 'Fredoka', sans-serif;
  font-weight: 700;
  font-size: 15px;
  color: var(--tinta);
}
.pic-simbolos { display: flex; flex-wrap: wrap; gap: 3px; font-size: 24px; line-height: 1.1; }
.pic-simb { animation: buPop .3s ease both; }
.pic-legenda {
  margin-top: 4px;
  font-size: 14px;
  font-weight: 700;
  color: var(--castanho);
  text-align: center;
}

/* ======================================================================
   MOTOR DE QUIZ — 10 jogos com níveis + cronómetro
   ====================================================================== */
.quiz-visual { display: flex; justify-content: center; margin: 4px 0 16px; }

/* Progresso: 3 níveis × 3 rounds */
.qprogresso {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: 16px;
  flex-wrap: wrap;
}
.qnivel {
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  padding: 6px 12px;
  border-radius: 14px;
  background: rgba(255,255,255,.35);
  opacity: .55;
}
.qnivel.nivel-actual { opacity: 1; background: rgba(32,56,166,.1); box-shadow: inset 0 0 0 2px var(--azul); }
.qnivel.nivel-feito { opacity: 1; background: #e7efd9; }
.qnivel-rot { font-family: 'Fredoka', sans-serif; font-weight: 700; font-size: 12.5px; color: var(--castanho); }
.qdots { display: flex; gap: 5px; }
.qdot { width: 10px; height: 10px; border-radius: 50%; background: var(--castanho-claro); transition: all .25s; }
.qdot.feito { background: var(--verde); }
.qdot.actual { background: var(--laranja); transform: scale(1.25); }

/* Frações — conjunto de objectos (fração de uma quantidade) */
.qfrac-conjunto {
  display: flex; flex-wrap: wrap; gap: 6px; justify-content: center;
  max-width: 460px; margin: 0 auto;
}
.qfrac-obj { font-size: 28px; line-height: 1; }
.qfrac-rotulo {
  text-align: center; margin-top: 10px;
  font-family: 'Fredoka', sans-serif; font-weight: 700; font-size: 22px; color: var(--azul);
}
/* Frações — barra dividida (equivalência) */
.qfrac-barra { display: grid; gap: 4px; width: 100%; max-width: 420px; margin: 0 auto; }
.qfrac-parte {
  height: 60px; border-radius: 10px;
  background: var(--creme); box-shadow: inset 0 0 0 3px var(--creme-escuro);
}
.qfrac-parte.cheia { background: linear-gradient(180deg, #7aa049, var(--verde)); box-shadow: inset 0 0 0 3px var(--verde-fundo); }

/* Ângulos */
.angulo-svg { height: auto; }

/* ======================================================================
   MENU POR CATEGORIAS (home) e lista de jogos de uma categoria
   ====================================================================== */
.home-mascote {
  display: flex; align-items: center; gap: 12px;
  justify-content: center;
  margin: 4px 16px 14px;
  text-align: center;
}

.cats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  padding: 0 16px 24px;
  max-width: 720px;
  margin: 0 auto;
}
.cat-card {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 18px 8px 14px;
  border-radius: 22px;
  background: rgba(250, 240, 225, .92);
  box-shadow: 0 6px 0 var(--creme-escuro);
}
.cat-card:active { transform: translateY(3px); box-shadow: 0 3px 0 var(--creme-escuro); }
.cat-icone {
  width: 68px; height: 68px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 34px;
}
.cat-nome {
  font-family: 'Fredoka', sans-serif; font-weight: 700; font-size: 16px;
  text-align: center; line-height: 1.1; color: var(--tinta);
}
.cat-n { font-size: 12.5px; font-weight: 700; color: var(--castanho); }

.jogos-lista {
  display: flex; flex-direction: column; gap: 12px;
  padding: 6px 16px 24px;
  max-width: 620px; margin: 0 auto;
}
.jogo-card {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 16px;
  border-radius: 20px;
  background: rgba(250, 240, 225, .92);
  box-shadow: 0 5px 0 var(--creme-escuro);
  text-align: left;
}
.jogo-card:active { transform: translateY(3px); box-shadow: 0 2px 0 var(--creme-escuro); }
.jogo-icone {
  width: 54px; height: 54px; flex: none;
  border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  font-size: 28px;
}
.jogo-txt { display: flex; flex-direction: column; flex: 1; gap: 2px; }
.jogo-nome { font-family: 'Fredoka', sans-serif; font-weight: 700; font-size: 18px; color: var(--tinta); }
.jogo-sub { font-size: 13.5px; font-weight: 700; color: var(--castanho); }
.jogo-seta { font-size: 18px; flex: none; }

@media (max-width: 560px) {
  .cats-grid { grid-template-columns: repeat(2, 1fr); }
  .cat-icone { width: 60px; height: 60px; font-size: 30px; }
}

/* ---------------------------------------- Motor Dominó (q14, q15) --------- */
/* Peça de dominó: ponta aberta (o valor dado) + meia-peça incógnita.
   Identidade Educativo — creme, azul, laranja; formas chunky, cantos suaves. */
.domino-peca{
  display:flex; align-items:stretch; justify-content:center;
  max-width:320px; margin:4px auto 2px; gap:0;
  background:#fff; border:3px solid var(--azul,#2038A6);
  border-radius:18px; box-shadow:0 4px 0 rgba(32,56,166,.18); overflow:hidden;
}
.domino-meia{
  flex:1; min-height:96px; display:flex; flex-direction:column;
  align-items:center; justify-content:center; padding:12px 10px; text-align:center;
}
.domino-aberta{ background:#FAF0E1; }
.domino-incognita{ background:rgba(250,100,21,.10); color:var(--laranja,#FA6415);
  font-size:44px; font-weight:800; line-height:1; }
.domino-divisor{ width:4px; background:var(--azul,#2038A6); opacity:.85; }
.domino-valor{ font-size:40px; font-weight:800; color:var(--azul,#2038A6); line-height:1.05; }
.domino-sub{ font-size:12px; font-weight:700; color:#8A8578; margin-top:4px;
  text-transform:uppercase; letter-spacing:.04em; }

/* ---------------------------------------- Motor Memória de Pares (m1..m3) --- */
.mem-grelha{ display:grid; gap:10px; margin:6px auto 4px; max-width:420px; }
.mem-carta{
  aspect-ratio:1/1; border:none; border-radius:14px; cursor:pointer;
  background:var(--azul,#2038A6); box-shadow:0 4px 0 rgba(22,41,111,.55);
  display:flex; align-items:center; justify-content:center; padding:4px;
  transition:transform .08s, background .15s;
}
.mem-carta:active{ transform:translateY(2px); box-shadow:0 2px 0 rgba(22,41,111,.55); }
.mem-carta .mem-face{ font-size:26px; font-weight:800; color:#fff; line-height:1; }
.mem-carta.aberta{ background:#FAF0E1; box-shadow:inset 0 0 0 3px var(--azul,#2038A6); }
.mem-carta.aberta .mem-face{ color:var(--azul,#2038A6); }
.mem-carta.feita{ background:#e7efd9; box-shadow:inset 0 0 0 3px var(--verde,#6B8F3E); cursor:default; }
.mem-carta.feita .mem-face{ color:var(--verde,#6B8F3E); }
@media (max-width:360px){ .mem-carta .mem-face{ font-size:21px; } }

/* ======================================================================== */
/* Motores tácteis — Reta numérica (r*) · Crivo (c*) · Fusão (f*)           */
/* Handoff Magalhães 24 Jul 2026. Vistas em static/js/motores.js.           */
/*                                                                          */
/* ⚠️ Não há barra de tempo nestes ecrãs, e é de propósito: a mecânica é o  */
/* toque e a matemática, não o relógio. Se um dia se acrescentar tempo, é   */
/* opcional e por jogo — ver o cabeçalho do motores.js antes de mexer.      */
/* ======================================================================== */

.mot-pergunta {
  font-family: 'Fredoka', sans-serif;
  font-weight: 600; font-size: 21px; line-height: 1.3;
  text-align: center; margin: 6px 18px 14px;
}

/* Botão de acção dos motores — mesma silhueta do .botao, largura da coluna */
.btn-grande {
  display: block; height: 70px; width: calc(100% - 32px);
  margin: 14px 16px 22px;
  border-radius: 20px;
  font-family: 'Fredoka', sans-serif; font-weight: 800; font-size: 26px;
  background: var(--verde); color: #fff;
  box-shadow: 0 5px 0 var(--verde-fundo);
}
.btn-grande:active { transform: translateY(3px); box-shadow: 0 2px 0 var(--verde-fundo); }
.btn-grande[disabled] {
  background: var(--castanho-claro); box-shadow: 0 5px 0 var(--castanho);
  color: rgba(255,255,255,.85); cursor: default;
}
.btn-grande[disabled]:active { transform: none; box-shadow: 0 5px 0 var(--castanho); }

/* ---------------------------------------------- Reta numérica (r1, r2, r3) */
/* A zona de toque é MUITO mais alta que a linha: o dedo de uma criança de 9
   anos não acerta numa linha de 6px, e falhar o toque não é matemática. */
.rt-zona {
  position: relative;
  height: 132px; margin: 8px 26px 4px;
  touch-action: none; cursor: pointer;
}
.rt-linha {
  position: absolute; left: 0; right: 0; top: 62px; height: 8px;
  border-radius: 4px; background: var(--azul);
}
.rt-marca { position: absolute; top: 52px; transform: translateX(-50%); text-align: center; }
.rt-tick { display: block; width: 4px; height: 28px; margin: 0 auto;
  border-radius: 2px; background: var(--azul); opacity: .55; }
.rt-num { display: block; margin-top: 4px; font-family: 'Fredoka', sans-serif;
  font-weight: 700; font-size: 14px; color: var(--castanho); white-space: nowrap; }
.rt-pin {
  position: absolute; top: 6px; transform: translateX(-50%);
  padding: 8px 13px; border-radius: 14px;
  font-family: 'Fredoka', sans-serif; font-weight: 800; font-size: 19px;
  background: var(--laranja); color: #fff;
  box-shadow: 0 4px 0 var(--laranja-fundo);
  white-space: nowrap; transition: left .12s ease;
}
.rt-pin::after {
  content: ''; position: absolute; left: 50%; top: 100%;
  width: 3px; height: 26px; margin-left: -1.5px;
  background: var(--laranja);
}
.rt-pin.ok { background: var(--verde); box-shadow: 0 4px 0 var(--verde-fundo); }
.rt-pin.ok::after { background: var(--verde); }
.rt-pin.mal { animation: buWigglePin .3s ease; }
/* keyframe próprio: o .rt-pin já usa translateX(-50%) para se centrar na
   posição, e o buWiggle genérico (só rotate) apagava esse translate — o pino
   saltava meia largura para a direita ao errar. */
@keyframes buWigglePin {
  0%,100% { transform: translateX(-50%) rotate(-4deg); }
  50%     { transform: translateX(-50%) rotate(4deg); }
}
.rt-etiqueta-fora {
  text-align: center; margin: 6px 24px 0;
  font-size: 16px; font-weight: 700; color: var(--castanho);
}

/* ------------------------------------------------------ Crivo (c1, c2) --- */
.cv-contador {
  text-align: center; font-family: 'Fredoka', sans-serif; font-weight: 800;
  font-size: 20px; color: var(--verde); margin-bottom: 8px;
}
.cv-grelha {
  display: grid; grid-template-columns: repeat(var(--cols, 10), 1fr);
  gap: 4px; max-width: 460px; margin: 0 auto; padding: 0 12px;
}
.cv-cel {
  aspect-ratio: 1/1;
  border-radius: 9px; background: rgba(250,240,225,.95);
  box-shadow: 0 3px 0 var(--creme-escuro);
  font-family: 'Fredoka', sans-serif; font-weight: 700;
  font-size: clamp(11px, 3.2vw, 16px); color: var(--tinta);
  display: flex; align-items: center; justify-content: center;
  transition: background .12s, color .12s;
}
.cv-cel:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--creme-escuro); }
.cv-cel.ok {
  background: var(--verde); color: #fff; box-shadow: 0 3px 0 var(--verde-fundo);
  cursor: default;
}
.cv-cel.mal {
  background: var(--laranja); color: #fff; box-shadow: 0 3px 0 var(--laranja-fundo);
  animation: buWiggle .3s ease;
}

/* ------------------------------------------------- Fusão para alvo (f*) -- */
.fu-alvo {
  display: flex; flex-direction: column; align-items: center;
  margin: 4px auto 16px; padding: 14px 26px; width: max-content;
  border-radius: 22px; background: rgba(250,240,225,.95);
  box-shadow: 0 5px 0 var(--creme-escuro);
}
.fu-soma { font-family: 'Fredoka', sans-serif; font-weight: 800; font-size: 46px;
  line-height: 1; color: var(--azul); }
.fu-de { font-weight: 700; font-size: 14px; color: var(--castanho);
  text-transform: uppercase; letter-spacing: .05em; margin-top: 4px; }
.fu-alvo.ok { box-shadow: 0 5px 0 var(--verde-fundo), inset 0 0 0 3px var(--verde); }
.fu-alvo.ok .fu-soma { color: var(--verde); }
.fu-alvo.mal { box-shadow: 0 5px 0 var(--laranja-fundo), inset 0 0 0 3px var(--laranja); }
.fu-alvo.mal .fu-soma { color: var(--laranja); }

.fu-pecas {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px;
  max-width: 420px; margin: 0 auto; padding: 0 16px;
}
.fu-peca {
  min-height: 66px; border-radius: 18px;
  background: rgba(250,240,225,.95); box-shadow: 0 4px 0 var(--creme-escuro);
  font-family: 'Fredoka', sans-serif; font-weight: 800; font-size: 26px;
  color: var(--tinta);
}
.fu-peca:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--creme-escuro); }
.fu-peca.on {
  background: var(--azul); color: #fff; box-shadow: 0 4px 0 var(--azul-fundo);
}
.fu-aviso {
  text-align: center; margin: 12px 20px 0;
  font-weight: 800; color: var(--laranja-fundo);
}

@media (max-width: 380px) {
  .rt-zona { margin-left: 18px; margin-right: 18px; }
  .fu-soma { font-size: 38px; }
}
