:root {
  --papel: #FFF8EC; --papel2: #FFEFD6; --tinta: #2B2340; --tinta2: #5D5470;
  --verde: #3A9D5D; --verde-esc: #2B7A47; --sol: #FFC531; --sol-esc: #E0A21A;
  --terra: #E2603C; --terra-esc: #B9472A; --azul: #3B82C4; --rosa: #F28CB1;
  --linha: #EADCC4; --branco: #fff;
  --raio: 22px; --sombra: 0 4px 0 rgba(43, 35, 64, .12), 0 10px 24px rgba(43, 35, 64, .08);
  --f-titulo: 'Baloo 2', 'Nunito', system-ui, sans-serif;
  --f-letra: 'Andika', 'Nunito', system-ui, sans-serif;
  --f-texto: 'Nunito', system-ui, sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  font-family: var(--f-texto); color: var(--tinta); background: var(--papel);
  background-image: radial-gradient(circle at 1px 1px, rgba(43,35,64,.05) 1px, transparent 0);
  background-size: 22px 22px; min-height: 100dvh; font-size: 17px; line-height: 1.45;
}
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
button:disabled { cursor: default; }
img, svg { display: block; }
h1, h2, h3 { font-family: var(--f-titulo); line-height: 1.1; margin: 0; }
b { font-weight: 800; }
.app { max-width: 520px; margin: 0 auto; min-height: 100dvh; display: flex; flex-direction: column; position: relative; }

/* ---------- botões ---------- */
.bt {
  display: inline-flex; align-items: center; justify-content: center; gap: .5em;
  background: var(--terra); color: #fff; font-family: var(--f-titulo); font-weight: 700; font-size: 1.15rem;
  padding: .85em 1.4em; border-radius: 18px; box-shadow: 0 5px 0 var(--terra-esc); transition: transform .08s, box-shadow .08s;
  text-decoration: none; text-align: center;
}
.bt:active:not(:disabled) { transform: translateY(4px); box-shadow: 0 1px 0 var(--terra-esc); }
.bt:disabled { background: #D9CFC0; box-shadow: 0 5px 0 #C2B6A4; color: #fff; }
.bt-grande { width: 100%; font-size: 1.25rem; }
.bt-verde { background: var(--verde); box-shadow: 0 5px 0 var(--verde-esc); }
.bt-verde:active:not(:disabled) { box-shadow: 0 1px 0 var(--verde-esc); }
.bt-sec { background: #fff; color: var(--tinta); box-shadow: 0 4px 0 var(--linha); border: 2px solid var(--linha); }
.bt-icone { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 12px; color: var(--tinta2); }
.bt-mini { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: #fff; border: 2px solid var(--linha); vertical-align: middle; color: var(--azul); }
.pulsa { animation: pulsa 1.6s ease-in-out infinite; }
@keyframes pulsa { 50% { transform: scale(1.035); } }

/* ---------- lição ---------- */
.lc-topo { display: flex; align-items: center; gap: 8px; padding: 12px 14px 6px; position: sticky; top: 0; background: var(--papel); z-index: 5; }
.lc-barra { flex: 1; height: 14px; border-radius: 99px; background: var(--papel2); overflow: hidden; box-shadow: inset 0 2px 0 rgba(0,0,0,.05); }
.lc-barra i { display: block; height: 100%; background: linear-gradient(90deg, var(--verde), #6CC77F); border-radius: 99px; transition: width .5s cubic-bezier(.3,1.4,.5,1); }
.xp { font-family: var(--f-titulo); font-weight: 700; background: var(--sol); padding: 3px 10px; border-radius: 99px; font-size: .9rem; white-space: nowrap; }
.xp.pulo { animation: pulo .45s; }
@keyframes pulo { 40% { transform: scale(1.3) rotate(-6deg); } }
.combo { background: var(--tinta); color: var(--sol); font-family: var(--f-titulo); font-weight: 700; font-size: .85rem; padding: 3px 9px; border-radius: 99px; display: inline-flex; gap: 3px; align-items: center; white-space: nowrap; }
.combo.pop { animation: pop .4s; }
@keyframes pop { 0% { transform: scale(.4); } 60% { transform: scale(1.25); } }
.lc-corpo { flex: 1; padding: 10px 18px 20px; display: flex; flex-direction: column; align-items: center; gap: 16px; }
.lc-corpo.entra { animation: entra .35s ease-out; }
@keyframes entra { from { opacity: 0; transform: translateY(14px); } }
.lc-pe { position: sticky; bottom: 0; padding: 10px 18px calc(16px + env(safe-area-inset-bottom)); background: linear-gradient(transparent, var(--papel) 30%); }
.aviso { margin: 0 0 10px; padding: 10px 14px; border-radius: 14px; font-weight: 800; text-align: center; animation: entra .25s; }
.aviso.bom { background: #DDF3E3; color: var(--verde-esc); }
.aviso.ruim { background: #FDE3DA; color: var(--terra-esc); }

.fala { display: flex; align-items: flex-end; gap: 8px; width: 100%; }
.tata-p { width: 64px; flex: none; }
.fala p { margin: 0 0 14px; background: #fff; border: 2px solid var(--linha); border-radius: 18px 18px 18px 4px; padding: 10px 14px; font-weight: 700; flex: 1; }
.selo { margin: 0; font-family: var(--f-titulo); font-weight: 700; font-size: .8rem; letter-spacing: .08em; text-transform: uppercase; color: #fff; background: var(--azul); padding: 3px 12px; border-radius: 99px; }
.pergunta { font-size: 1.55rem; text-align: center; }
.pergunta .alvo { font-family: var(--f-letra); color: var(--terra); }
.nota { margin: 0; color: var(--tinta2); font-size: .95rem; text-align: center; }
.fig { font-size: 3.2rem; line-height: 1; display: inline-grid; place-items: center; }
.fig-g { font-size: 5.5rem; }
.fig .tata { width: 1.25em; }

.carta-letra, .carta-fig {
  background: #fff; border-radius: 28px; box-shadow: var(--sombra); border: 3px solid var(--linha);
  padding: 18px 26px; display: flex; flex-direction: column; align-items: center; gap: 6px; width: min(100%, 330px); position: relative;
}
.carta-letra .letra { font-family: var(--f-letra); font-weight: 700; line-height: .9; color: var(--terra); }
.gigante { font-size: 8.5rem; }
.carta-letra .minus { position: absolute; top: 18px; right: 24px; font-family: var(--f-letra); font-size: 2.2rem; color: var(--tinta2); }
.dica { font-family: var(--f-titulo); font-size: 1.4rem; font-weight: 700; }
.ouvir { display: inline-flex; gap: 5px; align-items: center; color: var(--azul); font-weight: 800; font-size: .95rem; }

.grade-vogais { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; width: 100%; }
.carta-vogal { background: #fff; border: 3px solid var(--linha); border-radius: 20px; padding: 10px 4px 8px; display: flex; flex-direction: column; align-items: center; gap: 2px; box-shadow: 0 4px 0 var(--linha); }
.carta-vogal .letra { font-family: var(--f-letra); font-size: 2.6rem; font-weight: 700; color: var(--terra); line-height: 1; }
.carta-vogal .fig { font-size: 2rem; }
.carta-vogal small { font-size: .78rem; font-weight: 700; color: var(--tinta2); }
.carta-vogal.ouvida, .carta-sil.ouvida { border-color: var(--verde); box-shadow: 0 4px 0 var(--verde); }

.grade-sil { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; width: 100%; }
.carta-sil, .op-letra {
  font-family: var(--f-letra); font-weight: 700; font-size: 2.4rem; color: var(--tinta);
  background: #fff; border: 3px solid var(--linha); border-radius: 20px; padding: 16px 0; box-shadow: 0 5px 0 var(--linha);
  transition: transform .1s;
}
.carta-sil:active, .op:active { transform: translateY(3px); }
.bt-falante { width: 108px; height: 108px; border-radius: 50%; background: var(--azul); color: #fff; display: grid; place-items: center; box-shadow: 0 6px 0 #2C649A; animation: pulsa 1.8s infinite; }
.grade-op { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; width: 100%; }
.grade-op:has(> :nth-child(5)) { grid-template-columns: repeat(5, 1fr); }
.grade-op:has(> :nth-child(5)) .op-letra { font-size: 2rem; padding: 12px 0; }
.op.certa { background: #DDF3E3; border-color: var(--verde); box-shadow: 0 5px 0 var(--verde); color: var(--verde-esc); }
.op.apagada { opacity: .45; }
.treme { animation: treme .4s; }
@keyframes treme { 20%, 60% { transform: translateX(-7px); } 40%, 80% { transform: translateX(7px); } }

.lab { width: 100%; background: var(--tinta); border-radius: 26px; padding: 16px; color: #fff; }
.lab-tela { display: flex; justify-content: center; gap: 2px; font-family: var(--f-letra); font-weight: 700; font-size: 5rem; line-height: 1.1; color: var(--sol); background: rgba(255,255,255,.07); border-radius: 18px; margin-bottom: 8px; }
.lab-tela.junta { animation: junta .4s; }
.lab-tela.certa { color: #8BE3A2; }
@keyframes junta { 40% { letter-spacing: -.12em; transform: scale(1.1); } }
.lab-rot { margin: 8px 0 6px; font-size: .78rem; text-transform: uppercase; letter-spacing: .1em; opacity: .7; font-weight: 800; }
.lab-linha { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.lab-linha:has(> :nth-child(4):last-child) { grid-template-columns: repeat(4, 1fr); }
.lab-bt { font-family: var(--f-letra); font-weight: 700; font-size: 1.8rem; background: rgba(255,255,255,.12); color: #fff; border-radius: 14px; padding: 8px 0; }
.lab-bt.sel { background: var(--sol); color: var(--tinta); }

.slots { display: flex; gap: 10px; justify-content: center; }
.slot { min-width: 84px; height: 74px; border-radius: 18px; border: 3px dashed #CDBFA8; display: grid; place-items: center; font-family: var(--f-letra); font-weight: 700; font-size: 2.3rem; background: rgba(255,255,255,.6); }
.slot.cheio { border-style: solid; border-color: var(--azul); background: #fff; color: var(--azul); animation: pop2 .3s; }
.slots.certa .slot { border-color: var(--verde); color: var(--verde-esc); }
@keyframes pop2 { 50% { transform: scale(1.12); } }
.chips { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.chip { font-family: var(--f-letra); font-weight: 700; font-size: 2rem; background: #fff; border: 3px solid var(--linha); border-radius: 16px; padding: 8px 18px; box-shadow: 0 5px 0 var(--linha); }
.chip.usado { opacity: .2; }
.palavra-ler { display: flex; gap: 3px; font-family: var(--f-letra); font-weight: 700; font-size: 3.6rem; background: #fff; border-radius: 22px; padding: 6px 22px; box-shadow: var(--sombra); }
.palavra-ler span:nth-child(odd) { color: var(--terra); }
.palavra-ler span:nth-child(even) { color: var(--azul); }
.grade-fig { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; width: 100%; }
.op-fig { background: #fff; border: 3px solid var(--linha); border-radius: 20px; padding: 16px 0; box-shadow: 0 5px 0 var(--linha); display: grid; place-items: center; }

/* ---------- vitória ---------- */
.vitoria { flex: 1; display: flex; flex-direction: column; align-items: center; text-align: center; padding: 26px 20px calc(24px + env(safe-area-inset-bottom)); gap: 10px; }
.tata-g { width: 150px; animation: salta 1.2s ease-in-out infinite; }
@keyframes salta { 50% { transform: translateY(-8px); } }
.vitoria h1 { font-size: 2rem; }
.vitoria .sub { margin: 0; color: var(--tinta2); font-weight: 700; }
.estrelas { display: flex; gap: 6px; margin: 6px 0; }
.est { color: #E5DACA; transform: scale(.7); transition: transform .3s cubic-bezier(.3,1.8,.5,1); }
.est.brilha { color: var(--sol); transform: scale(1); filter: drop-shadow(0 3px 0 var(--sol-esc)); }
.placar { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.placar span { background: #fff; border: 2px solid var(--linha); border-radius: 99px; padding: 4px 12px; font-weight: 700; display: inline-flex; gap: 4px; align-items: center; }
.vit-pe { width: 100%; margin-top: auto; display: grid; gap: 10px; padding-top: 14px; }

/* ---------- confete ---------- */
.confete { position: fixed; inset: 0; pointer-events: none; z-index: 50; }
.confete i { position: absolute; top: 45%; width: 10px; height: 14px; border-radius: 3px; animation: voa 1.5s cubic-bezier(.2,.7,.4,1) forwards; }
@keyframes voa { to { transform: translate(var(--dx), calc(var(--dy) + 420px)) rotate(var(--r)); opacity: 0; } }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ---------- caça às letras ---------- */
.grade-caca { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; width: 100%; }
.caca-l { font-family: var(--f-letra); font-weight: 700; font-size: 2.2rem; aspect-ratio: 1; background: #fff; border: 3px solid var(--linha); border-radius: 50%; box-shadow: 0 4px 0 var(--linha); transition: transform .15s; }
.caca-l:nth-child(3n) { transform: rotate(-8deg); }
.caca-l:nth-child(4n+1) { transform: rotate(7deg); }
.caca-l.achou { background: var(--sol); border-color: var(--sol-esc); box-shadow: 0 4px 0 var(--sol-esc); transform: scale(1.08); animation: pop2 .3s; }

/* ---------- jogo da memória ---------- */
.grade-mem { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; width: 100%; }
.mem { position: relative; aspect-ratio: .82; }
.mem-verso, .mem-frente { position: absolute; inset: 0; display: grid; place-items: center; border-radius: 18px; border: 3px solid var(--linha); box-shadow: 0 4px 0 var(--linha); }
.mem-verso { background: var(--verde); border-color: var(--verde-esc); box-shadow: 0 4px 0 var(--verde-esc); }
.mem-tata { width: 62%; opacity: .9; }
.mem-frente { background: #fff; visibility: hidden; }
.mem.virada .mem-verso { visibility: hidden; }
.mem.virada .mem-frente { visibility: visible; }
.mem.virada { animation: vira .3s ease-out; }
@keyframes vira { 0% { transform: scaleX(.05); } 100% { transform: scaleX(1); } }
.mem-letra { font-family: var(--f-letra); font-size: 3rem; color: var(--terra); }
.mem.par .mem-frente { border-color: var(--verde); box-shadow: 0 4px 0 var(--verde); background: #EFFAF2; }

/* ---------- tabuada ---------- */
.num { font-family: var(--f-titulo) !important; }
.carta-letra .gigante.num { font-size: 7rem; color: var(--azul); }
.dica-txt { font-size: 1.05rem; color: var(--tinta2); font-weight: 700; max-width: 260px; }
.grade-tab { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; width: 100%; }
.tab-l { display: flex; justify-content: space-between; align-items: center; background: #fff; border: 3px solid var(--linha); border-radius: 16px; padding: 10px 16px; font-family: var(--f-titulo); font-size: 1.35rem; font-weight: 700; box-shadow: 0 4px 0 var(--linha); }
.tab-l b { color: transparent; background: var(--papel2); border-radius: 10px; min-width: 52px; padding: 0 6px; transition: .2s; }
.tab-l.vista { border-color: var(--verde); box-shadow: 0 4px 0 var(--verde); }
.tab-l.vista b { color: var(--verde-esc); background: #DDF3E3; }
.grupos { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.grupo { display: flex; flex-wrap: wrap; gap: 2px; max-width: 120px; justify-content: center; background: #fff; border: 3px dashed var(--sol-esc); border-radius: 18px; padding: 8px; font-size: 1.7rem; line-height: 1.1; }
.conta-txt { margin: 0; font-family: var(--f-titulo); font-size: 2.2rem; font-weight: 800; }
.conta-grande { display: grid; justify-items: center; gap: 4px; background: #fff; border: 3px solid var(--linha); border-radius: 28px; padding: 18px 30px; box-shadow: var(--sombra); min-width: 240px; }
.conta-grande span { font-family: var(--f-titulo); font-weight: 800; font-size: 4rem; line-height: 1; color: var(--azul); }
.conta-grande small { display: inline-flex; gap: 5px; color: var(--azul); font-weight: 800; }
.op-letra { font-family: var(--f-titulo) !important; }
.seq { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.seq span { font-family: var(--f-titulo); font-weight: 800; font-size: 2rem; min-width: 64px; text-align: center; background: #fff; border: 3px solid var(--linha); border-radius: 16px; padding: 6px 8px; }
.seq .buraco { border-style: dashed; border-color: var(--terra); color: var(--terra); }
.seq .buraco.cheio { border-style: solid; border-color: var(--verde); color: var(--verde-esc); animation: pop2 .3s; }
.caca-l.num { font-size: 1.7rem; }
.mem-conta { font-size: 1.9rem !important; color: var(--azul) !important; }
.selo-raio { background: var(--terra); }
.rel-topo { display: flex; gap: 10px; }
.rel-topo span { background: #fff; border: 2px solid var(--linha); border-radius: 99px; padding: 4px 14px; font-weight: 800; }
.rel-tempo b { color: var(--terra); font-family: var(--f-titulo); font-size: 1.3rem; }
.rel-barra { width: 100%; height: 12px; border-radius: 99px; background: var(--papel2); overflow: hidden; }
.rel-barra i { display: block; height: 100%; width: 100%; background: linear-gradient(90deg, var(--terra), var(--sol)); transition: width .2s linear; }
.rel-conta { min-height: 110px; align-content: center; }
