:root {
  --roxo: #7c3aed;
  --roxo-escuro: #5b21b6;
  --fundo: #fff7ed;
  --texto: #1f2937;
  --suave: #6b7280;
  --branco: #ffffff;
  --cartao: #ffffff;
  --linha: #e5e7eb;
  --trilho: #f3f4f6;
  --realce: #ede9fe;
  --sombra-apoio: #d1d5db;
  --ouro: #fbbf24;
  --verde: #22c55e;
  --vermelho: #ef4444;
  --raio: 22px;
  --sombra: 0 6px 0 rgba(0, 0, 0, 0.12);
  --cor: var(--roxo);
  --tabuleiro: #f6f1e7;
  --tabuleiro-borda: #e7d7c3;
  --seta: #5c3d2e;
  --brilho-1: #fde68a55;
  --brilho-2: #c4b5fd55;
  --tema-barra: #7c3aed;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-tema="claro"]) {
    --fundo: #1c1410;
    --texto: #f6f1e7;
    --suave: #c4b5a5;
    --cartao: #2a221c;
    --linha: #4a3d34;
    --trilho: #3a302a;
    --realce: #3b2d55;
    --sombra-apoio: #1a120e;
    --sombra: 0 6px 0 rgba(0, 0, 0, 0.45);
    --tabuleiro: #241c16;
    --tabuleiro-borda: #4a3b30;
    --seta: #f3e6d0;
    --brilho-1: #fde68a18;
    --brilho-2: #c4b5fd18;
    --tema-barra: #1c1410;
    color-scheme: dark;
  }
}

:root[data-tema="escuro"] {
  --fundo: #1c1410;
  --texto: #f6f1e7;
  --suave: #c4b5a5;
  --cartao: #2a221c;
  --linha: #4a3d34;
  --trilho: #3a302a;
  --realce: #3b2d55;
  --sombra-apoio: #1a120e;
  --sombra: 0 6px 0 rgba(0, 0, 0, 0.45);
  --tabuleiro: #241c16;
  --tabuleiro-borda: #4a3b30;
  --seta: #f3e6d0;
  --brilho-1: #fde68a18;
  --brilho-2: #c4b5fd18;
  --tema-barra: #1c1410;
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--fundo);
  background-image: radial-gradient(circle at 10% 0%, var(--brilho-1) 0, transparent 40%),
    radial-gradient(circle at 100% 30%, var(--brilho-2) 0, transparent 40%);
  color: var(--texto);
  font-family: "Nunito", "Baloo 2", "Segoe UI Rounded", "Segoe UI", system-ui, sans-serif;
  user-select: none;
  -webkit-user-select: none;
  overscroll-behavior: none;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
[hidden] { display: none !important; }

.app {
  max-width: 560px;
  margin: 0 auto;
  padding: max(16px, env(safe-area-inset-top)) 16px max(24px, env(safe-area-inset-bottom));
  min-height: 100vh;
}

/* ---------- Botões ---------- */
.botao {
  border: none;
  border-radius: 999px;
  padding: 14px 22px;
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--branco);
  background: var(--cor);
  box-shadow: 0 5px 0 rgba(0, 0, 0, 0.25);
  transition: transform 0.08s, box-shadow 0.08s;
  width: 100%;
}
.botao:active { transform: translateY(4px); box-shadow: 0 1px 0 rgba(0, 0, 0, 0.25); }
.botao-grande { font-size: 1.3rem; padding: 18px 24px; }
.botao-secundario { background: var(--trilho); color: var(--texto); box-shadow: 0 4px 0 var(--sombra-apoio); }

.botao-icone {
  width: 48px; height: 48px;
  border-radius: 16px;
  border: none;
  background: var(--cartao);
  box-shadow: var(--sombra);
  font-size: 1.4rem;
  display: grid; place-items: center;
  flex-shrink: 0;
}
.botao-icone:active { transform: translateY(3px); box-shadow: 0 2px 0 rgba(0,0,0,.12); }

/* ---------- Perfil / Início ---------- */
.perfil {
  display: flex; align-items: center; gap: 14px;
  background: linear-gradient(135deg, var(--roxo), #a855f7);
  color: var(--branco);
  padding: 16px;
  border-radius: var(--raio);
  box-shadow: 0 8px 0 var(--roxo-escuro);
}
.perfil-avatar {
  width: 72px; height: 72px; border-radius: 50%;
  border: 4px solid #ffffff88;
  background: #ffffff33;
  font-size: 2.6rem;
  display: grid; place-items: center;
  flex-shrink: 0;
}
.perfil-info { flex: 1; min-width: 0; }
.perfil-nome { font-size: 1.35rem; font-weight: 900; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.perfil-titulo { font-weight: 700; opacity: 0.95; }
.perfil-xp-texto { font-size: 0.8rem; opacity: 0.9; margin-top: 2px; }
.barra-xp { height: 12px; background: #ffffff40; border-radius: 99px; margin-top: 6px; overflow: hidden; }
.barra-xp-preenchida { height: 100%; width: 0; background: var(--ouro); border-radius: 99px; transition: width 0.8s ease; }

.perfil-botoes { display: flex; flex-direction: column; gap: 8px; }

.lista-idiomas { display: flex; flex-direction: column; gap: 10px; width: 100%; }
.botao-idioma {
  display: flex; align-items: center; gap: 12px;
  width: 100%; padding: 14px 18px; border-radius: 18px;
  border: 3px solid var(--linha); background: var(--cartao);
  font-size: 1.15rem; font-weight: 800; color: var(--texto); text-align: left;
}
.botao-idioma .bandeira { font-size: 1.8rem; }
.botao-idioma.selecionado { border-color: var(--roxo); background: var(--realce); }
.idiomas-mini { display: flex; gap: 8px; justify-content: center; }
.botao-idioma-mini {
  font-size: 1.5rem; width: 46px; height: 46px; border-radius: 50%;
  border: 3px solid transparent; background: var(--trilho); padding: 0;
}
.botao-idioma-mini.selecionado { border-color: var(--roxo); background: var(--realce); }

.placar { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 18px 0; }
.placar-item {
  background: var(--cartao); border-radius: 18px; padding: 10px 6px;
  text-align: center; box-shadow: var(--sombra);
  display: flex; flex-direction: column; align-items: center;
}
.placar-emoji { font-size: 1.6rem; }
.placar-item strong { font-size: 1.4rem; line-height: 1.1; }
.placar-item small { color: var(--suave); font-size: 0.75rem; }

.mascote-balao { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.mascote-balao p {
  position: relative; margin: 0; flex: 1;
  background: var(--cartao); padding: 12px 16px; border-radius: 18px;
  font-weight: 700; box-shadow: var(--sombra);
}
.mascote-mini { width: 64px; height: 64px; animation: flutuar 3s ease-in-out infinite; }
.mascote-grande { width: 110px; height: 110px; animation: flutuar 3s ease-in-out infinite; }

.secao-titulo { font-size: 1.2rem; font-weight: 900; margin: 20px 4px 10px; }

.grade-jogos { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.cartao-jogo {
  position: relative;
  background: var(--cor);
  color: var(--branco);
  border-radius: var(--raio);
  padding: 16px 12px 12px;
  display: flex; flex-direction: column; align-items: center; text-align: center;
  box-shadow: 0 7px 0 color-mix(in srgb, var(--cor) 70%, black);
  transition: transform 0.1s;
  animation: surgir 0.4s both;
}
.cartao-jogo:nth-child(2) { animation-delay: 0.05s; }
.cartao-jogo:nth-child(3) { animation-delay: 0.1s; }
.cartao-jogo:nth-child(4) { animation-delay: 0.15s; }
.cartao-jogo:nth-child(5) { animation-delay: 0.2s; }
.cartao-jogo:nth-child(6) { animation-delay: 0.25s; }
.cartao-jogo:nth-child(7) { animation-delay: 0.3s; }
.cartao-jogo:active { transform: translateY(5px); box-shadow: 0 2px 0 color-mix(in srgb, var(--cor) 70%, black); }
.cartao-emoji { font-size: 2.8rem; filter: drop-shadow(0 3px 0 rgba(0,0,0,.15)); }
.cartao-nome { font-weight: 900; font-size: 1.05rem; margin-top: 4px; line-height: 1.15; }
.cartao-habilidade { font-size: 0.78rem; opacity: 0.9; margin-top: 2px; }
.cartao-progresso { width: 100%; margin-top: 10px; }
.cartao-progresso-texto { font-size: 0.78rem; font-weight: 800; }
.mini-barra { display: block; height: 8px; background: #ffffff40; border-radius: 99px; overflow: hidden; margin-bottom: 4px; }
.mini-barra-preenchida { display: block; height: 100%; width: 0; background: var(--branco); border-radius: 99px; }

.rodape { text-align: center; color: var(--suave); font-size: 0.8rem; margin-top: 28px; }
.rodape a { text-decoration: underline; }

/* ---------- Modais ---------- */
.modal {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(17, 24, 39, 0.55);
  display: grid; place-items: center;
  padding: 20px;
  animation: aparecer 0.2s both;
}
.modal-caixa {
  background: var(--cartao);
  width: 100%; max-width: 420px;
  border-radius: 28px;
  padding: 24px 20px;
  text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  animation: pular 0.4s both;
  max-height: 92vh; overflow-y: auto;
}
.modal-caixa h2 { margin: 4px 0; font-size: 1.6rem; font-weight: 900; }
.modal-caixa p { margin: 0; color: var(--texto); }
.modal-emoji { font-size: 4rem; }
.como-jogar { font-size: 1.05rem; }
.dica-nivel { font-weight: 800; color: var(--cor) !important; }

#input-nome {
  width: 100%; font-size: 1.3rem; padding: 12px 16px;
  border: 3px solid var(--linha); border-radius: 16px;
  text-align: center; font-family: inherit; font-weight: 800;
  outline: none;
}
#input-nome:focus { border-color: var(--roxo); }
.grade-avatares { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 6px; width: 100%; }
.grade-avatares button {
  font-size: 1.6rem; aspect-ratio: 1; border-radius: 14px; padding: 0;
  border: 3px solid transparent; background: var(--trilho);
}
.grade-avatares button.selecionado { border-color: var(--roxo); background: var(--realce); transform: scale(1.08); }

.resultado-estrelas { font-size: 3.4rem; display: flex; gap: 6px; }
.resultado-estrelas span { animation: estrela-entra 0.5s both; filter: drop-shadow(0 4px 0 rgba(0,0,0,.15)); }
.resultado-estrelas span.apagada { filter: grayscale(1) opacity(0.3); }
.resultado-estrelas span:nth-child(2) { animation-delay: 0.2s; }
.resultado-estrelas span:nth-child(3) { animation-delay: 0.4s; }
.resultado-xp { font-weight: 900; color: var(--roxo) !important; font-size: 1.2rem; }
.resultado-botoes { display: flex; flex-direction: column; gap: 10px; width: 100%; margin-top: 6px; }

/* ---------- Tela do jogo ---------- */
.jogo-wrap { min-height: 100%; }
.topo-jogo {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  position: sticky; top: 0; z-index: 20;
  margin: calc(-1 * max(16px, env(safe-area-inset-top))) -16px 0;
  padding: max(12px, env(safe-area-inset-top)) 16px 12px;
  background: color-mix(in srgb, var(--fundo) 88%, transparent);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}
.topo-titulo { flex: 1; display: flex; flex-direction: column; align-items: center; text-align: center; }
.topo-titulo span { font-weight: 900; font-size: 1.2rem; }
.topo-titulo small { color: var(--suave); font-weight: 700; }
.topo-estrelas {
  background: var(--cartao); padding: 8px 12px; border-radius: 14px;
  font-weight: 900; box-shadow: var(--sombra); white-space: nowrap;
}
.descricao-jogo { text-align: center; color: var(--suave); font-weight: 700; margin: 14px 0 4px; }

.mapa { display: flex; flex-direction: column-reverse; align-items: center; gap: 4px; padding: 20px 0 30px; }
.mapa-nivel {
  position: relative;
  width: 78px; height: 78px; border-radius: 50%;
  border: none;
  background: var(--cor); color: var(--branco);
  font-size: 1.8rem; font-weight: 900;
  box-shadow: 0 7px 0 color-mix(in srgb, var(--cor) 65%, black);
  display: grid; place-items: center;
  transition: transform 0.1s;
}
.mapa-nivel:active { transform: translateY(5px); box-shadow: 0 2px 0 color-mix(in srgb, var(--cor) 65%, black); }
.mapa-nivel.bloqueado { background: var(--sombra-apoio); box-shadow: 0 7px 0 var(--suave); color: var(--suave); font-size: 1.5rem; }
.mapa-nivel.atual { animation: pulsar 1.4s ease-in-out infinite; outline: 6px solid color-mix(in srgb, var(--cor) 30%, transparent); }
.mapa-nivel-estrelas {
  position: absolute; bottom: -12px; left: 50%; transform: translateX(-50%);
  font-size: 0.95rem; white-space: nowrap; letter-spacing: -2px; color: var(--suave);
}
.mapa-linha { width: 8px; height: 26px; border-radius: 4px; background: color-mix(in srgb, var(--cor) 35%, white); }
.mapa-passo { display: flex; flex-direction: column; align-items: center; }
.mapa-passo.esq { transform: translateX(-60px); }
.mapa-passo.dir { transform: translateX(60px); }
.mapa-trofeu { font-size: 3rem; margin-bottom: 6px; }
.mapa-trofeu.bloqueado { filter: grayscale(1) opacity(.4); }
.mapa.mapa-grade {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px 8px;
  align-items: stretch;
  padding: 12px 0 24px;
}
.mapa.mapa-grade .mapa-nivel {
  width: 100%;
  height: auto;
  aspect-ratio: 1;
  font-size: 0.95rem;
  padding-bottom: 8px;
  box-shadow: 0 4px 0 color-mix(in srgb, var(--cor) 65%, black);
}
.mapa.mapa-grade .mapa-nivel.bloqueado {
  font-size: 0.95rem;
  box-shadow: 0 4px 0 var(--suave);
}
.mapa.mapa-grade .mapa-nivel-estrelas {
  bottom: 2px;
  font-size: 0.48rem;
  letter-spacing: -1px;
}
.mapa.mapa-grade .mapa-trofeu {
  grid-column: 1 / -1;
  text-align: center;
  margin: 4px 0 0;
}

.tabuleiro-setas {
  width: min(100%, 440px);
  background: var(--tabuleiro);
  border-radius: 22px;
  padding: 10px;
  box-shadow: inset 0 0 0 2px var(--tabuleiro-borda);
}
.tabuleiro-setas svg { width: 100%; height: auto; display: block; touch-action: manipulation; }
.traco-seta {
  fill: none; stroke: var(--seta); stroke-width: 7;
  stroke-linecap: butt; stroke-linejoin: round; pointer-events: none;
}
.ponta-seta { fill: var(--seta); stroke: none; pointer-events: fill; }
.traco-seta.dica { stroke: #7c3aed; }
.ponta-seta.dica { fill: #7c3aed; }
.traco-seta.saindo { stroke: #f59e0b; }
.ponta-seta.saindo { fill: #f59e0b; }
.traco-toque {
  fill: none; stroke: rgba(0, 0, 0, 0.01); stroke-width: 28;
  stroke-linecap: round; stroke-linejoin: round;
  pointer-events: stroke; cursor: pointer;
}
.caminho-seta.saindo,
.caminho-seta.saindo * { pointer-events: none; }
.caminho-seta,
.caminho-seta:focus { outline: none; }
.caminho-seta.travada { animation: tremer-seta 0.32s; }
@keyframes tremer-seta {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}

.vidas { font-size: 1.2rem; min-width: 48px; text-align: right; letter-spacing: -2px; }
.progresso-partida { height: 10px; background: var(--linha); border-radius: 99px; margin: 14px 0; overflow: hidden; }
.progresso-partida > div { height: 100%; width: 0; background: var(--cor); border-radius: 99px; transition: width 0.3s; }

.palco { display: flex; flex-direction: column; align-items: center; gap: 18px; padding-top: 6px; }
.enunciado { font-size: 1.25rem; font-weight: 900; text-align: center; margin: 0; }
.enunciado em { font-style: normal; color: var(--cor); }

/* Memória */
.grade-cartas { display: grid; gap: 10px; width: 100%; }
.carta {
  aspect-ratio: 3 / 4; border: none; border-radius: 16px; padding: 0;
  perspective: 600px; background: transparent;
}
.carta-interior {
  position: relative; width: 100%; height: 100%;
  transform-style: preserve-3d; transition: transform 0.35s;
}
.carta.virada .carta-interior, .carta.achada .carta-interior { transform: rotateY(180deg); }
.carta-face {
  position: absolute; inset: 0; border-radius: 16px;
  display: grid; place-items: center;
  backface-visibility: hidden; -webkit-backface-visibility: hidden;
  box-shadow: 0 5px 0 rgba(0,0,0,.15);
}
.carta-verso { background: var(--cor); color: #ffffffaa; font-size: 1.6rem; font-weight: 900; }
.carta-frente { background: var(--cartao); transform: rotateY(180deg); font-size: clamp(1.4rem, 8vw, 2.6rem); }
.carta.achada .carta-frente { background: #dcfce7; }

/* Siga a Luz */
.grade-luzes { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; width: 100%; max-width: 340px; }
.grade-luzes.seis { grid-template-columns: repeat(3, 1fr); }
.luz {
  aspect-ratio: 1; border: none; border-radius: 28px;
  background: var(--c); opacity: 0.45;
  box-shadow: 0 7px 0 color-mix(in srgb, var(--c) 60%, black);
  font-size: 2rem;
  transition: opacity 0.1s, transform 0.1s;
}
.luz.acesa { opacity: 1; transform: scale(1.06); filter: brightness(1.15); box-shadow: 0 0 30px var(--c), 0 7px 0 color-mix(in srgb, var(--c) 60%, black); }
.luz:disabled { cursor: default; }

/* Padrões */
.sequencia-padrao {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 8px;
  background: var(--cartao); padding: 16px; border-radius: var(--raio); box-shadow: var(--sombra); width: 100%;
}
.item-padrao {
  min-width: 52px; height: 58px; padding: 0 6px; border-radius: 14px;
  background: var(--trilho); display: grid; place-items: center;
  font-size: 1.9rem; font-weight: 900;
}
.item-padrao.misterio { background: color-mix(in srgb, var(--cor) 20%, white); color: var(--cor); border: 3px dashed var(--cor); animation: pulsar 1.2s infinite; }

.opcoes { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; width: 100%; }
.opcao {
  min-height: 76px; border: none; border-radius: 20px;
  background: var(--cartao); box-shadow: 0 6px 0 var(--sombra-apoio);
  font-size: 2rem; font-weight: 900; color: var(--texto);
  transition: transform 0.08s;
}
.opcao:active { transform: translateY(4px); box-shadow: 0 2px 0 var(--sombra-apoio); }
.opcao.certa { background: var(--verde); color: var(--branco); box-shadow: 0 6px 0 #15803d; animation: pular 0.35s; }
.opcao.errada { background: var(--vermelho); color: var(--branco); box-shadow: 0 6px 0 #b91c1c; animation: tremer 0.35s; }

/* Contas */
.conta {
  font-size: clamp(2.4rem, 12vw, 3.6rem); font-weight: 900;
  background: var(--cartao); border-radius: var(--raio); padding: 18px 28px;
  box-shadow: var(--sombra); text-align: center; width: 100%;
}
.barra-tempo { width: 100%; height: 14px; background: var(--linha); border-radius: 99px; overflow: hidden; }
.barra-tempo > div { height: 100%; width: 100%; background: var(--verde); border-radius: 99px; }
.barra-tempo.acabando > div { background: var(--vermelho); }

/* Cores */
.regra {
  padding: 8px 18px; border-radius: 999px; font-weight: 900; font-size: 1.05rem;
  background: var(--texto); color: var(--branco);
}
.regra.palavra { background: var(--roxo); }
.palavra-cor {
  font-size: clamp(2.2rem, 12vw, 4rem); font-weight: 900; letter-spacing: 1px; overflow-wrap: anywhere;
  background: var(--cartao); border-radius: var(--raio); padding: 22px 10px;
  width: 100%; text-align: center; box-shadow: var(--sombra);
}
.opcao-cor { font-size: 1.1rem; color: var(--branco); text-shadow: 0 2px 0 rgba(0,0,0,.25); }
.opcao-cor.certa, .opcao-cor.errada { color: var(--branco); }

/* Olho de Águia */
.grade-intruso { display: grid; gap: 6px; width: 100%; max-width: 420px; aspect-ratio: 1; }
.quadrado { border: none; border-radius: 12px; padding: 0; transition: transform 0.08s; }
.quadrado:active { transform: scale(0.92); }
.quadrado.revelado { outline: 5px solid var(--texto); animation: pulsar 0.6s infinite; }

/* ---------- Estágios ---------- */
.abas-estagio { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 14px 0 4px; }
.aba-estagio {
  display: flex; flex-direction: column; align-items: center; text-align: center;
  padding: 8px 4px; border-radius: 16px; background: var(--cartao);
  box-shadow: 0 4px 0 var(--linha); border: 3px solid transparent;
}
.aba-estagio strong { font-size: 0.9rem; font-weight: 900; }
.aba-estagio small { font-size: 0.7rem; color: var(--suave); font-weight: 700; line-height: 1.15; }
.aba-estagio.ativa { border-color: var(--cor); background: color-mix(in srgb, var(--cor) 12%, white); }
.aba-estagio.bloqueada { filter: grayscale(1); opacity: 0.6; }
.novidade-estagio {
  margin: 10px 0 0; padding: 10px 14px; border-radius: 16px; text-align: center; font-weight: 800;
  background: color-mix(in srgb, var(--cor) 14%, white); color: color-mix(in srgb, var(--cor) 70%, black);
}
.estagio-bloqueado {
  margin-top: 30px; padding: 24px; border-radius: var(--raio); background: var(--cartao); box-shadow: var(--sombra);
  display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; font-weight: 800;
}
.estagio-bloqueado .cadeado { font-size: 4rem; }
.estagio-bloqueado p { margin: 0; }
.selo-estagio {
  position: absolute; top: 8px; right: 8px; font-size: 0.75rem; font-weight: 900;
  background: var(--cartao); color: var(--cor); padding: 3px 8px; border-radius: 999px;
}

.carta.trocando { animation: trocar 0.6s ease; }
.grade-luzes.trocando .luz { animation: trocar 0.45s ease; }
@keyframes trocar { 0% { transform: scale(1); } 40% { transform: scale(0.75) rotate(-8deg); } 100% { transform: scale(1); } }

.item-clicavel { border: none; font-family: inherit; color: var(--texto); cursor: pointer; box-shadow: 0 4px 0 var(--sombra-apoio); }
.item-clicavel:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--sombra-apoio); }
.item-padrao.certa { background: var(--verde); color: var(--branco); animation: pular 0.35s; }
.item-padrao.errada { background: var(--vermelho); color: var(--branco); animation: tremer 0.35s; }

.regra.fundo { background: #0f766e; }
.palavra-cor.com-fundo { -webkit-text-stroke: 3px #fff; paint-order: stroke fill; }
.opcao-cor-mentirosa { font-size: 1.2rem; letter-spacing: 0.5px; }

.grade-intruso.figuras .quadrado { background: var(--cartao); box-shadow: 0 3px 0 var(--linha); display: grid; place-items: center; overflow: hidden; }
.figura-girada { display: inline-block; line-height: 1; }
.quadrado.achado { outline: 5px solid var(--verde); outline-offset: -5px; }

/* ---------- Desafio do Gênio ---------- */
a.botao { display: block; text-align: center; }

.cartao-desafio {
  display: flex; align-items: center; gap: 14px;
  padding: 18px 16px;
  border-radius: var(--raio);
  color: var(--branco);
  background: linear-gradient(135deg, #1e1b4b, #7c3aed 60%, #db2777);
  box-shadow: 0 7px 0 #1e1b4b;
  position: relative; overflow: hidden;
}
.cartao-desafio::after {
  content: "✨"; position: absolute; right: 44px; top: 6px; font-size: 1.2rem; animation: flutuar 2.4s ease-in-out infinite;
}
.cartao-desafio:active { transform: translateY(5px); box-shadow: 0 2px 0 #1e1b4b; }
.cartao-desafio-emoji { font-size: 3rem; animation: pulsar 2s ease-in-out infinite; }
.cartao-desafio-texto { flex: 1; display: flex; flex-direction: column; }
.cartao-desafio-texto strong { font-size: 1.3rem; font-weight: 900; }
.cartao-desafio-texto small { opacity: 0.85; font-weight: 700; }
.cartao-desafio-texto span { margin-top: 6px; font-weight: 800; color: var(--ouro); font-size: 0.9rem; }
.cartao-desafio-seta { font-size: 1.4rem; opacity: 0.8; }
.cartao-relax {
  margin: 8px 0 4px;
  color: #3f2a1d;
  background: linear-gradient(135deg, #f6f1e7, #e7d3b0 62%, #c4a574);
  box-shadow: 0 7px 0 #5c3d2e;
}
.cartao-relax::after { content: none; }
.cartao-relax:active { transform: translateY(5px); box-shadow: 0 2px 0 #5c3d2e; }
.cartao-relax .cartao-desafio-texto small { opacity: 0.8; }
.cartao-relax .cartao-desafio-texto span { color: #8a5a2b; }
@media (prefers-color-scheme: dark) {
  :root:not([data-tema="claro"]) .cartao-relax {
    color: #f6f1e7;
    background: linear-gradient(135deg, #3f2a1d, #5c3d2e 62%, #8a5a2b);
  }
  :root:not([data-tema="claro"]) .cartao-relax .cartao-desafio-texto span { color: #fbbf24; }
}
:root[data-tema="escuro"] .cartao-relax {
  color: #f6f1e7;
  background: linear-gradient(135deg, #3f2a1d, #5c3d2e 62%, #8a5a2b);
}
:root[data-tema="escuro"] .cartao-relax .cartao-desafio-texto span { color: #fbbf24; }

.desafio-intro, .desafio-final {
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: 12px;
  padding-top: 18px;
}
.desafio-intro h2, .desafio-final h2 { margin: 0; font-size: 1.6rem; font-weight: 900; }
.desafio-intro p, .desafio-final p { margin: 0; }
.desafio-areas { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; width: 100%; }
.desafio-areas span { background: var(--cartao); border-radius: 14px; padding: 10px; font-weight: 800; box-shadow: var(--sombra); }
.desafio-recorde { font-weight: 900; color: var(--roxo); }
.aviso { font-size: 0.8rem; color: var(--suave); max-width: 340px; }

.nivel-dificuldade { font-size: 0.85rem; font-weight: 800; color: var(--suave); margin-bottom: -8px; }
.explicacao {
  margin: 0; width: 100%; padding: 12px 14px; border-radius: 16px;
  background: #fef3c7; color: #78350f; font-weight: 700; text-align: center;
  animation: surgir 0.3s both;
}
#desafio-tempo { margin-bottom: 10px; }

.matriz {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px;
  width: 100%; max-width: 320px;
  background: var(--cartao); padding: 12px; border-radius: var(--raio); box-shadow: var(--sombra);
}
.celula-matriz {
  aspect-ratio: 1; border-radius: 14px; background: var(--trilho);
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center; align-content: center;
  font-size: 1.5rem; line-height: 1.1; padding: 4px; word-break: break-all; text-align: center;
}
.celula-matriz.misterio { background: color-mix(in srgb, var(--cor) 20%, white); border: 3px dashed var(--cor); font-size: 2rem; }
.opcao-pequena { font-size: 1.4rem; line-height: 1.1; word-break: break-all; padding: 6px; }
.opcoes-tres { grid-template-columns: repeat(3, 1fr); }

.balanca {
  width: 100%; background: var(--cartao); border-radius: var(--raio); padding: 14px; box-shadow: var(--sombra);
  display: flex; flex-direction: column; gap: 8px;
}
.linha-balanca { font-size: 1.8rem; font-weight: 900; text-align: center; padding: 6px; border-radius: 12px; background: var(--trilho); }
.linha-balanca.pergunta { background: color-mix(in srgb, var(--cor) 18%, white); color: var(--cor); }

.analogia { width: 100%; display: flex; flex-direction: column; gap: 10px; }
.linha-analogia {
  display: flex; align-items: center; justify-content: center; gap: 18px;
  background: var(--cartao); border-radius: var(--raio); padding: 12px; box-shadow: var(--sombra);
  font-size: 2.6rem;
}
.linha-analogia .seta { font-size: 1.6rem; color: var(--suave); }
.linha-analogia .misterio { color: var(--cor); }

.caixa-figura { background: var(--cartao); border-radius: var(--raio); padding: 16px; box-shadow: var(--sombra); }
.figura { display: grid; gap: 3px; width: 64px; }
.figura.grande { width: 120px; gap: 4px; }
.figura span { aspect-ratio: 1; border-radius: 4px; background: var(--linha); }
.figura span.ligada { background: var(--cor); }
.opcao .figura { margin: 8px auto; }
.opcao.certa .figura span.ligada, .opcao.errada .figura span.ligada { background: var(--branco); }
.opcao.certa .figura span:not(.ligada), .opcao.errada .figura span:not(.ligada) { background: #ffffff40; }

.medalha { font-size: 6rem; animation: estrela-entra 0.7s both; filter: drop-shadow(0 6px 0 rgba(0,0,0,.15)); }
.final-frase { font-weight: 800; color: var(--suave); }
.final-pontos { font-size: 1.2rem; font-weight: 800; }
.final-pontos strong { font-size: 3rem; color: var(--roxo); display: block; line-height: 1; }
.final-areas {
  width: 100%; background: var(--cartao); border-radius: var(--raio); padding: 14px; box-shadow: var(--sombra);
  display: flex; flex-direction: column; gap: 10px;
}
.area-linha { display: grid; grid-template-columns: 110px 1fr 40px; align-items: center; gap: 8px; font-weight: 800; text-align: left; }
.area-barra { height: 12px; background: var(--linha); border-radius: 99px; overflow: hidden; }
.area-barra > div { height: 100%; background: linear-gradient(90deg, var(--roxo), #db2777); border-radius: 99px; }
.area-placar { text-align: right; color: var(--suave); }

/* ---------- Conquistas ---------- */
.lista-titulos { display: flex; gap: 10px; overflow-x: auto; padding: 4px 4px 12px; scroll-snap-type: x mandatory; }
.titulo-item {
  flex: 0 0 104px; scroll-snap-align: start;
  background: var(--cartao); border-radius: 18px; padding: 12px 8px; text-align: center;
  box-shadow: var(--sombra);
}
.titulo-item .emoji { font-size: 2.2rem; display: block; }
.titulo-item strong { display: block; font-size: 0.9rem; }
.titulo-item small { color: var(--suave); font-size: 0.75rem; }
.titulo-item.bloqueado { filter: grayscale(1); opacity: 0.5; }
.titulo-item.atual { outline: 4px solid var(--roxo); }

.grade-conquistas { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.conquista {
  background: var(--cartao); border-radius: 18px; padding: 14px 10px; text-align: center;
  box-shadow: var(--sombra);
}
.conquista .emoji { font-size: 2.6rem; display: block; }
.conquista strong { display: block; margin-top: 4px; }
.conquista small { color: var(--suave); }
.conquista.bloqueada .emoji { filter: grayscale(1) opacity(0.35); }
.conquista.bloqueada strong { color: var(--suave); }
.conquista-barra { height: 6px; background: var(--linha); border-radius: 99px; margin-top: 8px; overflow: hidden; }
.conquista-barra > div { height: 100%; background: var(--ouro); }
.zona-perigo { margin-top: 36px; opacity: 0.8; }

.texto-legal { background: var(--cartao); border-radius: var(--raio); padding: 8px 20px 18px; margin-top: 16px; box-shadow: var(--sombra); line-height: 1.5; }
.texto-legal h3 { margin-bottom: 4px; }
.texto-legal a { color: var(--roxo); text-decoration: underline; }

/* ---------- Toast e confete ---------- */
.toast-area { position: fixed; top: 16px; left: 0; right: 0; z-index: 80; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; }
.toast {
  background: var(--texto); color: var(--branco); font-weight: 800;
  padding: 12px 20px; border-radius: 999px; box-shadow: 0 8px 20px rgba(0,0,0,.25);
  animation: toast 3s both; max-width: 90vw; text-align: center;
}
.toast.ouro { background: linear-gradient(135deg, #f59e0b, #fbbf24); color: #422006; }
.confete { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 90; }

.feedback-flutuante {
  position: fixed; left: 50%; top: 40%; z-index: 70;
  font-size: 4rem; pointer-events: none;
  animation: subir 0.8s both;
}

/* ---------- Animações ---------- */
@keyframes flutuar { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
@keyframes surgir { from { opacity: 0; transform: translateY(16px) scale(0.95); } to { opacity: 1; transform: none; } }
@keyframes aparecer { from { opacity: 0; } to { opacity: 1; } }
@keyframes pular { 0% { transform: scale(0.7); } 60% { transform: scale(1.06); } 100% { transform: scale(1); } }
@keyframes pulsar { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.07); } }
@keyframes tremer { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-8px); } 75% { transform: translateX(8px); } }
@keyframes estrela-entra { 0% { transform: scale(0) rotate(-90deg); opacity: 0; } 70% { transform: scale(1.3) rotate(10deg); opacity: 1; } 100% { transform: scale(1) rotate(0); } }
@keyframes toast { 0% { opacity: 0; transform: translateY(-20px); } 10%, 85% { opacity: 1; transform: none; } 100% { opacity: 0; transform: translateY(-20px); } }
@keyframes subir { 0% { opacity: 0; transform: translate(-50%, 20px) scale(0.6); } 30% { opacity: 1; transform: translate(-50%, 0) scale(1.1); } 100% { opacity: 0; transform: translate(-50%, -60px) scale(1); } }

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