/*
 * Cruzadinha — visual de papel recortado (cartolina de papelaria).
 * Tudo é uma folha de papel em cima de outra: cor chapada, canto pouco
 * arredondado e uma sombra dura e curta, que é a espessura do papel.
 */

/* Fontes hospedadas junto com o site (subconjunto latino, variáveis). Licença: SIL OFL 1.1. */
@font-face {
  font-family: "Fredoka";
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url("/recursos/fontes/fredoka-latin.woff2") format("woff2");
}
@font-face {
  font-family: "Karla";
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
  src: url("/recursos/fontes/karla-latin.woff2") format("woff2");
}

:root {
  /* cartolinas */
  --ceu: #cfe8ee;        /* fundo da mesa */
  --papel: #fffdf6;      /* casas de letra */
  --anil: #24316f;       /* tinta: texto e contornos */
  --anil-suave: #5b66a0;
  --gema: #ffc93c;       /* palavra selecionada */
  --tangerina: #ff8a3d;  /* casa ativa */
  --chiclete: #ff6f91;
  --folha: #2fa36b;
  --piscina: #2f9fd0;
  --uva: #7a5cc7;
  --erro: #e23d57;

  --sombra: rgba(36, 49, 111, 0.28);
  --sombra-forte: rgba(36, 49, 111, 0.42);

  --fonte-recorte: "Fredoka", "Trebuchet MS", "Segoe UI", sans-serif;
  --fonte-texto: "Karla", "Segoe UI", system-ui, sans-serif;

  --casa: 40px;          /* recalculado no script para caber na tela */
  --doca-altura: 0px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  color: var(--anil);
  font-family: var(--fonte-texto);
  font-size: 17px;
  line-height: 1.45;
  background-color: var(--ceu);
  /* fibra do papel */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='f'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .14 0 0 0 0 .19 0 0 0 0 .43 0 0 0 .07 0'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23f)'/%3E%3C/svg%3E");
  padding-bottom: calc(var(--doca-altura) + env(safe-area-inset-bottom, 0px));
}

button { font: inherit; color: inherit; }

/* ---------- anúncios: altura reservada, longe do tabuleiro e do teclado ---------- */

.anuncio {
  display: grid;
  place-items: center;
  margin: 0 auto;
  color: var(--anil-suave);
  font-size: 13px;
  border: 2px dashed rgba(36, 49, 111, 0.25);
  border-radius: 6px;
}
.anuncio-topo { width: min(100% - 16px, 728px); height: 60px; margin-top: 8px; }
.anuncio-lado { width: 100%; height: 260px; margin-top: 28px; }

/* ---------- cabeçalho: cena de papel em camadas ---------- */

.topo {
  position: relative;
  height: 146px;
  overflow: hidden;
}
.cena { position: absolute; inset: 0; width: 100%; height: 100%; }
.cena .papel { filter: drop-shadow(0 -2px 0 var(--sombra)); }
.sol {
  position: absolute;
  right: max(18px, calc(50% - 500px));
  top: 14px;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--gema);
  box-shadow: 2px 3px 0 var(--sombra);
}
.morro-a { fill: var(--piscina); }
.morro-b { fill: var(--folha); }
.morro-c { fill: var(--chiclete); }

.titulo {
  position: relative;
  width: min(100% - 28px, 1080px);
  margin: 0 auto;
  padding-top: 32px;
}
.titulo .marca {
  position: relative;
  isolation: isolate;       /* o sol fica atrás das letras, mas na frente do cenário */
  width: max-content;
  margin: 0;
  font-family: var(--fonte-recorte);
  font-weight: 700;
  font-size: clamp(38px, 10.5vw, 56px);
  line-height: 1.05;
  letter-spacing: 0.03em;
  color: var(--papel);
  -webkit-text-stroke: 1.5px var(--anil);
  paint-order: stroke fill;
}
/* cada letra é um recorte solto: um pouco torta, numa altura própria,
   colada sobre outra folha colorida que aparece por baixo */
.titulo .marca .l {
  display: inline-block;
  transform: translateY(var(--altura)) rotate(var(--giro));
  text-shadow: 0.055em 0.07em 0 var(--camada), 0.055em 0.11em 0 var(--sombra);
}
/* "dia" de Cruzadia: outro pedaço de papel, amarelo, colado um pouco torto */
.titulo .marca .ia {
  display: inline-block;
  color: var(--gema);
  margin-left: 0.03em;
}
/* sol de papel atrás das letras finais "dia": disco laranja e duas camadas de raios
   desiguais, que giram devagar em sentidos opostos. O sol é filho do título inteiro
   (e não só de "dia") para ficar atrás de todas as letras, inclusive as vizinhas.
   83.4% é o centro de "dia" dentro da palavra "Cruzadia" nesta fonte. */
.sol-marca {
  position: absolute;
  z-index: -1;
  left: 83.4%;
  top: 52%;
  width: 2.7em;
  height: 2.7em;
  margin: -1.35em 0 0 -1.35em;
  overflow: visible;
  filter: drop-shadow(0.03em 0.05em 0 var(--sombra));
}
.sol-disco { fill: var(--tangerina); animation: respirar-sol 5s ease-in-out infinite; }
.sol-raios { stroke-linejoin: round; stroke-width: 3; }
.sol-raios-longos { fill: var(--gema); stroke: var(--gema); animation: girar-sol 46s linear infinite; }
.sol-raios-curtos { fill: #ffe38f; stroke: #ffe38f; animation: girar-sol 30s linear infinite reverse; }
/* cada raio estica e encolhe de leve a partir do centro do sol, no seu próprio ritmo */
.sol-raio { animation: esticar-raio var(--ritmo) ease-in-out var(--atraso) infinite alternate; }
@keyframes girar-sol { to { transform: rotate(360deg); } }
@keyframes respirar-sol { 50% { transform: scale(1.05); } }
@keyframes esticar-raio { to { transform: scale(var(--pico)); } }
.titulo .subtitulo {
  position: relative;   /* fica na frente do sol */
  margin: 6px 0 0;
  font-weight: 600;
  font-size: 15px;
}

/* ---------- abertura: acontece uma vez, ao carregar a página ---------- */
/* Os morros sobem, o sol nasce, as letras do nome caem uma a uma e o tabuleiro se monta. */

.abrindo .cena .papel {
  transform-box: fill-box;
  animation: subir-morro 760ms cubic-bezier(.2, 1.2, .4, 1) backwards;
}
.abrindo .morro-b { animation-delay: 110ms; }
.abrindo .morro-c { animation-delay: 220ms; }
@keyframes subir-morro { from { transform: translateY(110%); } }

/* o sol da marca abre por trás do "a" depois que a letra pousa */
.abrindo .sol-marca { animation: nascer 900ms cubic-bezier(.2, 1.5, .4, 1) 1000ms backwards; }
@keyframes nascer { from { transform: scale(0) rotate(-180deg); } }

.abrindo .titulo .marca .l {
  animation: cair-letra 640ms cubic-bezier(.2, 1.6, .35, 1) backwards;
  animation-delay: calc(260ms + var(--i) * 75ms);
}
@keyframes cair-letra {
  from { transform: translateY(-90px) rotate(calc(var(--giro) * 6)); opacity: 0; }
  60% { opacity: 1; }
}
/* "dia" chega por último e dá um pulo a mais */
.abrindo .titulo .marca .ia { animation: pulo-dia 520ms cubic-bezier(.3, 1.7, .5, 1) 1150ms backwards; }
@keyframes pulo-dia { 45% { transform: translateY(-9px) scale(1.12); } }

.abrindo .titulo .subtitulo { animation: aparecer 400ms ease-out 1000ms backwards; }
@keyframes aparecer { from { opacity: 0; transform: translateY(6px); } }

.abrindo .tabuleiro .casa {
  animation: montar-casa 340ms cubic-bezier(.2, 1.5, .4, 1) backwards;
  animation-delay: calc(650ms + var(--ordem, 0) * 26ms);
}
@keyframes montar-casa { from { transform: scale(0.3) rotate(-10deg); opacity: 0; } }

/* ---------- site: menu, dia, tamanhos, rodapé, páginas de texto ---------- */

a { color: inherit; }
[hidden] { display: none !important; }

.titulo .marca a { display: inline-block; color: inherit; text-decoration: none; }

.menu {
  position: absolute;
  top: 8px;
  right: max(14px, calc(50% - 540px));
  display: flex;
  gap: 6px;
}
.menu a, .rodape nav a {
  padding: 5px 11px 4px;
  border-radius: 8px;
  font-family: var(--fonte-recorte);
  font-weight: 500;
  font-size: 15px;
  text-decoration: none;
}
.menu a { background: var(--papel); box-shadow: 0 2px 0 var(--sombra); }
.menu a:hover, .rodape nav a:hover { background: var(--gema); }

.dia { margin-bottom: 14px; }
.dia h1, .dia h2 {
  margin: 0 0 10px;
  font-family: var(--fonte-recorte);
  font-weight: 600;
  font-size: clamp(20px, 5vw, 26px);
  line-height: 1.15;
  text-wrap: balance;
}
.dia h1::first-letter, .dia h2::first-letter { text-transform: uppercase; }
.dia-nav { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 10px 0 0; font-size: 15px; }

.tamanhos { display: flex; flex-wrap: wrap; gap: 8px; }
.tamanhos a, .arquivo-tamanhos a {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  padding: 6px 12px 5px;
  border-radius: 8px;
  background: var(--papel);
  box-shadow: 0 2px 0 var(--sombra);
  font-family: var(--fonte-recorte);
  font-weight: 500;
  font-size: 15px;
  text-decoration: none;
}
.tamanhos small, .arquivo-tamanhos small { font-family: var(--fonte-texto); font-size: 13px; color: var(--anil-suave); }
.tamanhos a[aria-current] { background: var(--anil); color: var(--papel); }
.tamanhos a[aria-current] small { color: #c9d0f2; }

.texto {
  width: min(100% - 28px, 720px);
  margin: 24px auto 48px;
  padding: 22px 22px 26px;
  border-radius: 12px;
  background: var(--papel);
  box-shadow: 0 4px 0 var(--sombra);
}
.pagina-jogo .texto { margin-top: 0; }
.texto h1 { margin: 0 0 12px; font-family: var(--fonte-recorte); font-weight: 600; font-size: clamp(26px, 6vw, 34px); line-height: 1.1; }
.texto h2 { margin: 26px 0 8px; font-family: var(--fonte-recorte); font-weight: 600; font-size: 21px; line-height: 1.2; }
.texto h2:first-child { margin-top: 0; }
.texto p, .texto li { max-width: 66ch; }
.texto p { margin: 0 0 12px; }
.texto ul { margin: 0 0 12px; padding-left: 1.2em; }
.texto .nota { margin-top: 22px; font-size: 14px; color: var(--anil-suave); }
.texto .botao { display: inline-block; text-decoration: none; margin: 4px 8px 4px 0; }

.arquivo-lista { margin: 0 0 8px; padding: 0; list-style: none; display: grid; gap: 10px; }
.arquivo-lista li { display: grid; gap: 6px; padding-bottom: 10px; border-bottom: 2px dashed rgba(36, 49, 111, 0.16); max-width: none; }
.arquivo-dia { font-weight: 600; }
.arquivo-dia::first-letter { text-transform: uppercase; }
.arquivo-tamanhos { display: flex; flex-wrap: wrap; gap: 8px; }
.arquivo-tamanhos a { background: var(--ceu); }
.arquivo-tamanhos a.resolvida { background: var(--folha); color: var(--papel); }
.arquivo-tamanhos a.comecada { background: var(--gema); }
.arquivo-tamanhos a.resolvida small, .arquivo-tamanhos a.resolvida .situacao { color: #dff5e9; }
.situacao { font-family: var(--fonte-texto); font-size: 12px; }

.rodape {
  width: min(100% - 28px, 1080px);
  margin: 0 auto;
  padding: 18px 0 30px;
  border-top: 2px dashed rgba(36, 49, 111, 0.22);
  font-size: 14px;
}
.rodape nav { display: flex; flex-wrap: wrap; gap: 4px 6px; margin: 0 0 10px -11px; }
.rodape p { margin: 0; color: var(--anil-suave); }

/* ---------- formulário de aviso de erro ---------- */

.formulario { display: grid; gap: 6px; }
.formulario label { margin-top: 8px; font-weight: 600; font-size: 15px; }
.formulario select, .formulario textarea, .formulario input {
  width: 100%;
  padding: 9px 10px;
  border: 2px solid rgba(36, 49, 111, 0.3);
  border-radius: 8px;
  background: #fff;
  color: var(--anil);
  font: inherit;
  font-size: 16px;   /* abaixo disso o iPhone dá zoom ao focar */
}
.formulario textarea { resize: vertical; min-height: 96px; }
.formulario-nota { margin: 0; font-size: 14px; color: var(--anil-suave); }
.formulario-estado { min-height: 1.4em; margin: 6px 0 2px; font-weight: 600; font-size: 15px; }
.formulario-estado.erro { color: var(--erro); }
.formulario-estado.certo { color: #1c7a4d; }
.formulario .botao { justify-self: start; margin-top: 4px; }
.isca { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* ---------- aviso de cookies ---------- */

.cookies {
  position: fixed;
  left: 10px; right: 10px;
  bottom: calc(var(--doca-altura) + 10px);
  z-index: 30;
  max-width: 560px;
  margin: 0 auto;
  padding: 14px 16px;
  border-radius: 12px;
  background: var(--papel);
  box-shadow: 0 5px 0 var(--sombra-forte);
  font-size: 15px;
}
.cookies p { margin: 0 0 10px; }
.cookies-acoes { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---------- mesa ---------- */

.mesa {
  width: min(100% - 16px, 1080px);
  margin: 14px auto 40px;
  display: grid;
  gap: 28px;
}

.acoes {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}
.acoes-extras { justify-content: center; margin: 4px 0 0; }

.botao {
  appearance: none;
  border: 0;
  cursor: pointer;
  padding: 9px 14px 8px;
  border-radius: 9px;
  font-family: var(--fonte-recorte);
  font-weight: 600;
  font-size: 16px;
  background: var(--papel);
  box-shadow: 0 3px 0 var(--sombra);
  transition: transform 80ms, box-shadow 80ms;
}
.botao:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--sombra); }
.botao:disabled { cursor: default; opacity: 0.55; }
.botao-dica { background: var(--gema); }
.botao-leve { background: transparent; box-shadow: inset 0 0 0 2px rgba(36, 49, 111, 0.3); }
.botao-leve:active { box-shadow: inset 0 0 0 2px rgba(36, 49, 111, 0.3); }
/* chave liga/desliga: uma pastilha que desliza, com a palavra "ligado/desligado" para leitores de tela */
.chave { display: inline-flex; align-items: center; gap: 9px; }
.chave::after {
  content: "";
  width: 34px;
  height: 20px;
  border-radius: 10px;
  background:
    radial-gradient(circle at 10px 10px, var(--papel) 0 7px, transparent 7.5px),
    rgba(36, 49, 111, 0.35);
  transition: background-color 120ms;
}
.chave[aria-pressed="true"]::after {
  background:
    radial-gradient(circle at 24px 10px, var(--papel) 0 7px, transparent 7.5px),
    var(--folha);
}
.botao .conta {
  display: inline-grid;
  place-items: center;
  min-width: 1.5em;
  height: 1.5em;
  margin-left: 4px;
  border-radius: 50%;
  background: var(--anil);
  color: var(--papel);
  font-size: 0.82em;
}

:focus-visible { outline: 3px solid var(--uva); outline-offset: 2px; }

/* ---------- tabuleiro ---------- */

.tabuleiro-base {
  width: max-content;
  max-width: 100%;
  margin: 0 auto;
  padding: 7px;
  border-radius: 10px;
  background: var(--anil);
  box-shadow: 0 5px 0 var(--sombra-forte);
}

.tabuleiro {
  display: grid;
  grid-template-columns: repeat(var(--colunas), var(--casa));
  grid-auto-rows: var(--casa);
  gap: 3px;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}

.casa {
  position: relative;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 5px;
  cursor: pointer;
  font-family: var(--fonte-recorte);
  -webkit-tap-highlight-color: transparent;
}

.casa-letra {
  background: var(--papel);
  color: var(--anil);
  font-weight: 600;
  font-size: calc(var(--casa) * 0.58);
  line-height: 1;
  box-shadow: inset 0 -2px 0 rgba(36, 49, 111, 0.13);
  transition: background-color 90ms, transform 90ms;
}
.letra { display: block; }
.letra.colada { animation: colar-letra 260ms cubic-bezier(.2, 1.7, .35, 1) both; }
@keyframes colar-letra {
  0% { transform: scale(0.2) rotate(-18deg); opacity: 0; }
  55% { opacity: 1; }
  100% { transform: none; }
}
.casa-letra.na-palavra { background: var(--gema); }
.casa-letra.ativa {
  background: var(--tangerina);
  color: var(--papel);
  transform: translateY(-2px);
  box-shadow: 0 3px 0 var(--sombra-forte);
  z-index: 2;
}
/* cursor: um traço que pisca na casa ativa, mostrando onde a próxima letra entra */
.casa-letra.ativa::before {
  content: "";
  position: absolute;
  left: 20%;
  right: 20%;
  bottom: 9%;
  height: 3px;
  border-radius: 2px;
  background: var(--papel);
  animation: piscar 1.1s steps(1) infinite;
}
@keyframes piscar { 50% { opacity: 0; } }
/* casa ativa já preenchida: a letra pulsa, como texto selecionado prestes a ser trocado */
.casa-letra.ativa.ocupada .letra { animation: pulsar-letra 1.1s ease-in-out infinite; }
@keyframes pulsar-letra { 50% { opacity: 0.4; } }
.casa-letra.errada { color: var(--erro); }
.casa-letra.errada::after {
  /* canto dobrado vermelho: marca de letra errada que não depende só da cor do texto */
  content: "";
  position: absolute;
  top: 0; right: 0;
  border-style: solid;
  border-width: 0 calc(var(--casa) * 0.3) calc(var(--casa) * 0.3) 0;
  border-color: transparent var(--erro) transparent transparent;
  border-top-right-radius: 5px;
}
.casa-letra.ativa.errada { color: var(--papel); }

/* casas de pergunta: quadrados de cartolina, cada um de uma cor */
.casa-pergunta { color: var(--papel); }
.casa-pergunta.cor-0 { background: var(--chiclete); }
.casa-pergunta.cor-1 { background: var(--folha); }
.casa-pergunta.cor-2 { background: var(--piscina); }
.casa-pergunta.cor-3 { background: var(--uva); }
/* pergunta escolhida: a casa ganha moldura amarela e sobe; a seta dela vira uma pastilha amarela */
.casa-pergunta.escolhida {
  box-shadow: 0 0 0 3px var(--gema), 0 4px 0 3px var(--sombra-forte);
  transform: translateY(-2px);
  z-index: 3;
}

.seta {
  position: absolute;
  width: 54%;
  height: 54%;
  transform: translate(-50%, -50%);
  fill: none;
  stroke: currentColor;
  stroke-width: 3.4;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
}
/* casa com duas perguntas: dois pedaços de papel, separados por uma linha clara;
   a metade de baixo/direita fica um tom mais escura */
.casa-pergunta.duas::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  --linha: rgba(255, 253, 246, 0.9);
  --tom: rgba(36, 49, 111, 0.2);
  background: linear-gradient(var(--sentido),
    transparent 0 calc(50% - 0.5px),
    var(--linha) calc(50% - 0.5px) calc(50% + 0.5px),
    var(--tom) calc(50% + 0.5px));
}
.casa-pergunta.divide-h { --sentido: to bottom; }          /* linha horizontal */
.casa-pergunta.divide-v { --sentido: to right; }           /* linha vertical */
.casa-pergunta.divide-desce { --sentido: to bottom left; } /* diagonal \, do canto de cima à esquerda ao de baixo à direita */
.casa-pergunta.divide-sobe { --sentido: to bottom right; } /* diagonal /, do canto de baixo à esquerda ao de cima à direita */
.casa-pergunta.duas .seta { width: 40%; height: 40%; stroke-width: 3.8; }
.seta { transition: transform 140ms cubic-bezier(.2, 1.6, .4, 1); }
.seta.acesa {
  color: var(--anil);
  background: var(--gema);
  border-radius: 50%;
  box-shadow: 0 2px 0 var(--sombra-forte);
  transform: translate(-50%, -50%) scale(1.18);
  stroke-width: 4;
}
.casa-pergunta.duas .seta.acesa { transform: translate(-50%, -50%) scale(1.3); stroke-width: 4.4; }
.seta.apagada { opacity: 0.3; }

/* enunciado dentro da casa: só na versão impressa */
.q-textos { display: none; }

.aviso {
  min-height: 1.6em;
  margin: 12px 0 0;
  text-align: center;
  font-family: var(--fonte-recorte);
  font-weight: 500;
}

/* ---------- doca: pergunta ativa + teclado ---------- */

.pista {
  display: grid;
  grid-template-columns: 44px 1fr 44px 44px;
  align-items: center;
  gap: 4px;
  min-height: 58px;
  padding: 6px;
  border-radius: 10px;
  background: var(--papel);
  box-shadow: 0 3px 0 var(--sombra);
}
.pista-texto {
  margin: 0;
  text-align: center;
  font-weight: 600;
  font-size: 17px;
  line-height: 1.25;
  text-wrap: balance;
}
.pista-texto small {
  display: block;
  font-weight: 400;
  font-size: 13px;
  color: var(--anil-suave);
}
.pista-texto small.troca { font-weight: 600; color: #b8480a; }
.pista-nav {
  appearance: none;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
}
.pista-nav svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.pista-nav:active { background: rgba(36, 49, 111, 0.1); }
.pista-limpar { color: var(--erro); }
.pista-limpar svg { stroke-width: 2.4; }

.teclado { display: none; }

.tecla {
  appearance: none;
  flex: 1 1 0;
  min-width: 0;
  height: 46px;
  border: 0;
  border-radius: 7px;
  background: var(--papel);
  box-shadow: 0 2px 0 var(--sombra);
  font-family: var(--fonte-recorte);
  font-weight: 600;
  font-size: 19px;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.tecla:active { transform: translateY(2px); box-shadow: none; background: var(--gema); }
.tecla-apagar { flex: 1.6 1 0; background: var(--chiclete); color: var(--papel); }
.tecla-apagar svg { width: 24px; height: 24px; vertical-align: middle; fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }

/* Tela de toque: a doca fica presa embaixo, com teclado próprio. */
body.toque .doca {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 20;
  padding: 8px 6px calc(8px + env(safe-area-inset-bottom, 0px));
  background: var(--anil);
  box-shadow: 0 -4px 0 var(--sombra);
}
body.toque .pista { box-shadow: none; margin-bottom: 8px; }
body.toque .teclado { display: grid; gap: 7px; }
body.toque .teclado-linha { display: flex; gap: 5px; justify-content: center; }
body.toque .teclado-linha:nth-child(2) { padding: 0 4.5%; }

body:not(.toque) .doca { margin-bottom: 14px; }

/* ---------- lado: banco de dicas e perguntas ---------- */

.lado h2 {
  margin: 0 0 8px;
  font-family: var(--fonte-recorte);
  font-weight: 600;
  font-size: 22px;
  line-height: 1.15;
}

.banco {
  padding: 16px 16px 18px;
  border-radius: 10px;
  background: var(--papel);
  box-shadow: 0 4px 0 var(--sombra);
}
.banco-ajuda { margin: 0; max-width: 46ch; }
.banco-lista {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.banco-lista:not(:empty) { margin-top: 14px; }
.banco-lista li {
  padding: 5px 12px 4px;
  border-radius: 6px;
  background: var(--gema);
  box-shadow: 0 3px 0 var(--sombra);
  font-family: var(--fonte-recorte);
  font-weight: 600;
  font-size: 19px;
  letter-spacing: 0.06em;
}
.banco-lista li:nth-child(odd) { transform: rotate(-1.4deg); }
.banco-lista li:nth-child(even) { transform: rotate(1.1deg); }
.banco-lista li.nova { animation: colar 380ms cubic-bezier(.2, 1.5, .4, 1); }
@keyframes colar { from { transform: translateY(-14px) rotate(-6deg); opacity: 0; } }

.enunciados { margin-top: 26px; }
.enunciados h2:not(:first-child) { margin-top: 22px; }
.lista-perguntas {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 2px;
}
.lista-perguntas button {
  appearance: none;
  display: flex;
  gap: 10px;
  align-items: baseline;
  justify-content: space-between;
  width: 100%;
  padding: 7px 10px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  text-align: left;
  cursor: pointer;
}
.lista-perguntas button:hover { background: rgba(255, 253, 246, 0.6); }
.lista-perguntas .letras { flex: none; font-size: 14px; color: var(--anil-suave); }
.lista-perguntas li.atual button { background: var(--gema); }
.lista-perguntas li.atual .letras { color: var(--anil); }
.lista-perguntas li.preenchida button { color: var(--anil-suave); text-decoration: line-through; text-decoration-color: rgba(36, 49, 111, 0.35); }

.banco-impresso { display: none; }

/* ---------- popup de resultado: conferência e fim de jogo ---------- */

.resultado {
  width: min(100% - 28px, 380px);
  padding: 26px 24px 24px;
  border: 0;
  border-radius: 14px;
  background: var(--papel);
  color: var(--anil);
  text-align: center;
  box-shadow: 0 7px 0 var(--sombra-forte);
  overflow: visible;   /* o papel picado sai de dentro do popup e cai pela tela */
}
.resultado::backdrop { background: rgba(36, 49, 111, 0.55); }
.resultado[open] { animation: entrar-popup 320ms cubic-bezier(.2, 1.5, .4, 1); }
@keyframes entrar-popup { from { opacity: 0; scale: 0.82; } }
.resultado h2 {
  margin: 10px 0 6px;
  font-family: var(--fonte-recorte);
  font-weight: 700;
  font-size: 30px;
  line-height: 1.1;
  text-wrap: balance;
}
.resultado p { margin: 0 auto 18px; max-width: 28ch; text-wrap: pretty; }
.resultado-botao { min-width: 150px; font-size: 18px; }
.festa-popup { position: fixed; z-index: 1; }

.resultado-figura { height: 128px; }
.figura { display: none; width: 128px; height: 128px; overflow: visible; filter: drop-shadow(0 4px 0 var(--sombra)); }
.resultado-certo .figura-certo,
.resultado-erro .figura-erro,
.resultado-fim .figura-fim,
.resultado-vazio .figura-vazio { display: inline-block; }

.figura .olho { fill: var(--anil); }
.figura .boca { fill: none; stroke: var(--anil); stroke-width: 4.5; stroke-linecap: round; stroke-linejoin: round; }
.figura .boca-aberta { fill: var(--erro); }
.figura .sobrancelha { fill: none; stroke: var(--anil); stroke-width: 4; stroke-linecap: round; }

/* sem erros: o sol pula e os raios giram */
.figura-certo .raios { fill: var(--tangerina); transform-origin: 60px 60px; }
.figura-certo .rosto { fill: var(--gema); }
.figura-certo .bochecha { fill: var(--chiclete); opacity: 0.75; }
.resultado-certo[open] .figura-certo { animation: pular 700ms cubic-bezier(.3, 1.6, .5, 1) 2; }
.resultado-certo[open] .figura-certo .raios { animation: girar 2.6s linear infinite; }
.resultado-certo h2 { color: var(--folha); }
@keyframes pular { 50% { transform: translateY(-16px) rotate(6deg); } }
@keyframes girar { to { transform: rotate(360deg); } }

/* com erros: a nuvem balança a cabeça e chora */
.figura-erro .nuvem { fill: var(--piscina); }
.figura-erro .gota { fill: var(--piscina); }
.resultado-erro[open] .figura-erro { animation: negar 520ms ease-in-out 3; }
.resultado-erro[open] .gota { animation: pingar 900ms ease-in infinite; }
.resultado-erro[open] .gota-2 { animation-delay: 300ms; }
.resultado-erro[open] .gota-3 { animation-delay: 600ms; }
.resultado-erro h2 { color: var(--erro); }
@keyframes negar { 25% { transform: rotate(-9deg); } 75% { transform: rotate(9deg); } }
@keyframes pingar { 0% { transform: translateY(-8px); opacity: 0; } 30% { opacity: 1; } 100% { transform: translateY(22px); opacity: 0; } }

/* fim: a estrela gira ao chegar e fica pulsando */
.figura-fim .estrela { fill: var(--gema); stroke: var(--tangerina); stroke-width: 4; stroke-linejoin: round; }
.resultado-fim[open] .figura-fim { animation: chegar 800ms cubic-bezier(.2, 1.5, .4, 1), pulsar 1.4s ease-in-out 800ms infinite; }
.resultado-fim h2 { color: var(--uva); }
@keyframes chegar { from { transform: scale(0.2) rotate(-200deg); } }
@keyframes pulsar { 50% { transform: scale(1.08) rotate(4deg); } }

/* nada escrito: o lápis faz que escreve */
.figura-vazio .lapis-corpo { fill: var(--gema); }
.figura-vazio .lapis-ponta { fill: var(--anil); }
.figura-vazio .lapis-borracha { fill: var(--chiclete); }
.resultado-vazio[open] .figura-vazio { animation: rabiscar 600ms ease-in-out 3; }
@keyframes rabiscar { 50% { transform: translate(8px, -4px) rotate(-8deg); } }

/* ---------- popup "Como jogar" ---------- */

.ajuda {
  width: min(100% - 28px, 430px);
  max-height: calc(100dvh - 28px);
  padding: 20px 22px 22px;
  border: 0;
  border-radius: 12px;
  background: var(--papel);
  color: var(--anil);
  box-shadow: 0 6px 0 var(--sombra-forte);
  overflow: auto;
}
.ajuda::backdrop { background: rgba(36, 49, 111, 0.55); }
.ajuda h2 { margin: 0 0 14px; font-family: var(--fonte-recorte); font-weight: 600; font-size: 26px; line-height: 1.1; }
.ajuda h3 { margin: 18px 0 8px; font-family: var(--fonte-recorte); font-weight: 600; font-size: 18px; }
.ajuda h3:first-of-type { margin-top: 0; }
.ajuda-fechar {
  appearance: none;
  position: absolute;
  top: 12px; right: 12px;
  width: 40px; height: 40px;
  border: 0;
  border-radius: 50%;
  background: var(--chiclete);
  color: var(--papel);
  box-shadow: 0 2px 0 var(--sombra);
  cursor: pointer;
}
.ajuda-fechar svg { width: 20px; height: 20px; vertical-align: middle; fill: none; stroke: currentColor; stroke-width: 3; stroke-linecap: round; }
.teclas { margin: 0; display: grid; gap: 7px; }
.teclas div { display: grid; grid-template-columns: 9.6em 1fr; align-items: center; gap: 10px; }
.teclas dt { display: flex; flex-wrap: wrap; align-items: center; gap: 3px; }
.teclas dd { margin: 0; }
kbd {
  display: inline-block;
  min-width: 1.8em;
  padding: 2px 6px 1px;
  border-radius: 5px;
  background: var(--ceu);
  box-shadow: 0 2px 0 var(--sombra);
  font-family: var(--fonte-recorte);
  font-weight: 600;
  font-size: 14px;
  text-align: center;
}
.toques { margin: 0; padding-left: 1.1em; display: grid; gap: 6px; }
/* o popup mostra só o que serve para o aparelho: gestos na tela de toque, teclas no computador */
.ajuda-toque { display: none; }
body.toque .ajuda-toque { display: block; }
body.toque .ajuda-teclado { display: none; }

/* ---------- festa de papel picado ao terminar ---------- */

.festa { position: fixed; inset: 0; overflow: hidden; pointer-events: none; z-index: 40; }
.festa i {
  position: absolute;
  top: -20px;
  width: 11px;
  height: 16px;
  border-radius: 2px;
  animation: cair linear forwards;
}
@keyframes cair {
  to { transform: translate3d(var(--dx), 108vh, 0) rotate(var(--giro)); }
}
.tabuleiro.terminada .casa-letra { animation: pulo 520ms ease both; animation-delay: calc(var(--ordem) * 18ms); }
@keyframes pulo { 40% { transform: translateY(-7px); background: var(--gema); } }

@media (prefers-reduced-motion: reduce) {
  .festa { display: none; }
  .tabuleiro.terminada .casa-letra, .banco-lista li.nova, .letra.colada { animation: none; }
  .resultado[open], .resultado[open] .figura, .resultado[open] .figura * { animation: none !important; }
  .sol-raios, .sol-disco, .sol-raio { animation: none; }
  .abrindo .cena .papel, .abrindo .sol-marca, .abrindo .titulo .marca .l, .abrindo .titulo .marca .ia,
  .abrindo .titulo .subtitulo, .abrindo .tabuleiro .casa { animation: none !important; }
  .casa-letra, .botao, .tecla, .seta { transition: none; }
  .casa-letra.ativa::before, .casa-letra.ativa.ocupada .letra { animation: none; }
}

/* ---------- telas largas: tabuleiro à esquerda, perguntas à direita ---------- */

@media (min-width: 900px) {
  .mesa { grid-template-columns: max-content minmax(280px, 1fr); gap: 40px; align-items: start; }
  .topo { height: 184px; }
  .titulo { padding-top: 48px; }
  .sol { width: 64px; height: 64px; top: 18px; }
}

/* ---------- impressão: no estilo da revista, com o enunciado dentro da casa ---------- */

@media print {
  @page { margin: 12mm; }
  body { background: #fff; padding: 0; font-size: 11pt; color: #000; }
  .anuncio, .acoes, .doca, .aviso, .lado, .festa, .cena, .sol, .ajuda, .resultado, .menu, .rodape, .cookies, .dia-nav, .tamanhos, .pagina-jogo .texto { display: none !important; }
  body { padding-bottom: 0 !important; }
  .topo { height: auto; overflow: visible; }
  .titulo { width: 100%; padding: 0 0 4mm; display: flex; align-items: baseline; gap: 5mm; }
  .titulo .marca { font-size: 22pt; color: #000; text-shadow: none; -webkit-text-stroke: 0; }
  .titulo .marca .l { transform: none; text-shadow: none; animation: none !important; }
  .sol-marca { display: none; }
  .titulo .marca .ia { color: #000; text-decoration: underline; text-decoration-thickness: 1.2pt; text-underline-offset: 2pt; animation: none !important; }
  .tabuleiro .casa { animation: none !important; }
  .titulo .subtitulo { margin: 0; font-size: 10pt; }
  .mesa { display: block; width: 100%; margin: 0; }
  .tabuleiro-base { width: 100%; padding: 0; background: none; box-shadow: none; border-radius: 0; }
  .tabuleiro {
    /* cabe numa folha A4 em pé: limitado pela largura e também pela altura */
    width: min(100%, calc(236mm * var(--colunas) / var(--linhas)));
    margin: 0 auto;
    grid-template-columns: repeat(var(--colunas), 1fr);
    grid-auto-rows: auto;
    gap: 0;
    border-top: 0.4mm solid #000;
    border-left: 0.4mm solid #000;
  }
  .casa {
    container-type: size;
    aspect-ratio: 1;
    border-radius: 0;
    border-right: 0.4mm solid #000;
    border-bottom: 0.4mm solid #000;
    background: #fff !important;
    box-shadow: none !important;
    transform: none !important;
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }
  .casa-letra { color: transparent !important; }  /* sai em branco, para resolver a lápis */
  .casa-letra::after, .casa-letra::before { display: none; }
  .casa-pergunta { color: #000; background: #e9e9e9 !important; overflow: hidden; }
  .seta { display: none; }
  .casa-pergunta.duas::before { display: none; }   /* no papel, as duas perguntas já são separadas por um traço */
  .q-textos {
    position: absolute;
    inset: 0;
    display: grid;
    grid-auto-rows: 1fr;
  }
  .q-textos span {
    position: relative;
    display: grid;
    place-items: center;
    padding: 2cqw 15cqw 2cqw 5cqw;
    font-family: Arial, Helvetica, sans-serif;
    font-weight: 700;
    font-size: clamp(4.6pt, 9.6cqw, 7.4pt);
    line-height: 1.06;
    text-align: center;
    hyphens: auto;
    overflow-wrap: anywhere;
  }
  .q-seta {
    position: absolute;
    right: 1.5cqw;
    bottom: 1.5cqw;
    width: 15cqw;
    height: 15cqw;
    fill: none;
    stroke: #000;
    stroke-width: 3.2;
    stroke-linecap: round;
    stroke-linejoin: round;
  }
  .q-textos span + span { border-top: 0.3mm solid #000; }
  .banco-impresso {
    display: block;
    width: min(100%, calc(236mm * var(--colunas-impressas, 9) / var(--linhas-impressas, 12)));
    margin: 3mm auto 0;
    font-size: 8pt;
    text-align: right;
    transform: rotate(180deg);   /* de cabeça para baixo, como na revista */
  }
}
