/* Construção (os três porquinhos e a obra): só o que as brincadeiras precisam além do estilo.css. Tudo começa com cn-. */

/* ---------- menu ---------- */
.cn-apresenta { width: 116px; }
.abertura-arte .cn-porco, .abertura-arte .cn-lobo { width: 120px; margin: 0 auto; }
.abertura-arte .cn-casa-arte { width: 150px; margin: 0 auto; }
.cn-brincadeira-emoji { background: repeating-linear-gradient(-45deg, #fde68a 0 10px, #fef3c7 10px 20px); }
.cn-irmaos { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.cn-irmao {
  position: relative; display: flex; flex-direction: column; align-items: center; padding: 6px 4px 8px; border-radius: 20px;
  background: rgba(255, 255, 255, .92); box-shadow: var(--sombra); border-bottom: 6px solid var(--cor);
}
.cn-irmao-arte { position: absolute; left: 2px; bottom: 34px; width: 38%; z-index: 1; animation: balanca 2.6s ease-in-out infinite; }
.cn-irmao:nth-child(2) .cn-irmao-arte { animation-delay: -.8s; }
.cn-irmao:nth-child(3) .cn-irmao-arte { animation-delay: -1.6s; }
.cn-irmao-casa { width: 84%; margin-left: 16%; }
.cn-irmao small { position: relative; z-index: 2; margin-top: 4px; font-size: 14px; font-weight: 800; text-align: center; line-height: 1.1; }
.cn-irmao svg, .cn-apresenta svg { display: block; width: 100%; height: auto; }

/* ---------- comuns ---------- */
.cn-vez { font-size: 20px; padding: 8px 14px; }
.cn-contagem { gap: 6px; }
.cn-contagem .contagem-item { font-size: 15px; padding: 3px 10px; }
.cn-agora { background: var(--cor) !important; color: #fff; text-shadow: 0 1px 1px rgba(0, 0, 0, .35); }
.cn-dourada { align-self: center; padding: 6px 16px; border-radius: 999px; background: linear-gradient(90deg, #fde047, #f59e0b); color: #78350f; font-weight: 900; box-shadow: 0 4px 0 #b45309; animation: pula .4s cubic-bezier(.2, 1.6, .4, 1); }
.cn-recado { margin: 0; padding: 10px 14px; border-radius: 18px; background: var(--branco); box-shadow: var(--sombra); font-size: 18px; font-weight: 700; text-align: center; line-height: 1.3; }
.cn-recado b { color: var(--roxo-escuro); }
.cn-porque { background: #fef3c7; border: 3px solid #f59e0b; }
.cn-linha-botoes { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }

/* O gesto pedido: mãozinha animada e texto curto. */
.cn-gesto {
  align-self: center; display: inline-flex; align-items: center; gap: 8px; padding: 6px 16px 6px 10px; border-radius: 999px;
  background: rgba(255, 255, 255, .95); color: var(--tinta); font-size: 18px; line-height: 1.15; box-shadow: 0 4px 0 rgba(42, 26, 94, .2);
  animation: pula .35s cubic-bezier(.2, 1.6, .4, 1);
}
.cn-dica { display: flex; justify-content: center; min-height: 44px; }
.cn-mao { display: inline-block; font-size: 30px; line-height: 1; }
.cn-gesto-tocar .cn-mao, .cn-gesto-martelar .cn-mao, .cn-mao-tocar { animation: cn-mao-toca 1s ease-in-out infinite; }
.cn-gesto-deslizar .cn-mao, .cn-mao-deslizar { animation: cn-mao-desliza 1.3s ease-in-out infinite; }
.cn-gesto-segurar .cn-mao, .cn-mao-segurar { animation: cn-mao-segura 1.6s ease-in-out infinite; }
.cn-gesto-arrastar .cn-mao, .cn-mao-arrastar { animation: cn-mao-arrasta 1.6s ease-in-out infinite; }
.cn-gesto-ligar .cn-mao, .cn-mao-ligar { animation: cn-mao-liga 1.8s ease-in-out infinite; }
.cn-gesto-pinca .cn-mao, .cn-mao-pinca { animation: cn-mao-pinca 1.2s ease-in-out infinite; }
@keyframes cn-mao-toca { 0%, 100% { transform: translateY(-5px); } 45% { transform: translateY(4px) scale(.88); } }
@keyframes cn-mao-desliza { 0%, 100% { transform: translateX(-12px) rotate(-8deg); } 50% { transform: translateX(12px) rotate(8deg); } }
@keyframes cn-mao-segura { 0% { transform: translateY(-5px); filter: none; } 25%, 85% { transform: translateY(4px) scale(.86); filter: drop-shadow(0 0 5px #f59e0b); } 100% { transform: translateY(-5px); } }
@keyframes cn-mao-arrasta { 0% { transform: translate(-10px, 8px) scale(.9); } 60% { transform: translate(12px, -10px) scale(.9); } 100% { transform: translate(-10px, 8px); } }
@keyframes cn-mao-liga { 0%, 40% { transform: translate(-12px, 2px); } 20% { transform: translate(-12px, 7px) scale(.86); } 60%, 100% { transform: translate(12px, 2px); } 80% { transform: translate(12px, 7px) scale(.86); } }
@keyframes cn-mao-pinca { 0%, 100% { transform: scale(.85); } 50% { transform: scale(1.3); } }
.cn-mao-solta {
  position: absolute; z-index: 6; pointer-events: none; font-size: 40px; line-height: 1; margin: -6px 0 0 -14px;
  filter: drop-shadow(0 3px 2px rgba(0, 0, 0, .35));
}
.cn-mao-solta.cn-mao-arrastar { animation: cn-mao-sobe 1.6s ease-in-out infinite; }
@keyframes cn-mao-sobe { 0% { transform: translate(0, 0) scale(.9); opacity: 0; } 15% { opacity: 1; } 75% { transform: translate(0, -70px); opacity: 1; } 100% { transform: translate(0, -70px); opacity: 0; } }

/* Arrastar: o fantasma que segue o dedo. */
.cn-fantasma { position: fixed; left: 0; top: 0; z-index: 90; pointer-events: none; display: grid; place-items: center; filter: drop-shadow(0 10px 8px rgba(0, 0, 0, .3)); }
.cn-fantasma svg { width: 100%; height: 100%; }
.cn-pegando { opacity: .35; }

/* Segurar: o anel que enche. */
.cn-anel { position: fixed; z-index: 95; width: 84px; height: 84px; margin: -42px 0 0 -42px; pointer-events: none; }
.cn-anel svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.cn-anel circle { fill: none; stroke-width: 7; }
.cn-anel-fundo { stroke: rgba(255, 255, 255, .55); }
.cn-anel-cheio { stroke: #fde047; stroke-linecap: round; stroke-dasharray: 100 100; stroke-dashoffset: 100; animation: cn-enche var(--ms) linear forwards; }
@keyframes cn-enche { to { stroke-dashoffset: 0; } }

/* Zoom (pinça, roda do mouse e lupa). */
.cn-zoom { position: relative; overflow: hidden; touch-action: none; border-radius: 22px; }
.cn-zoom-miolo { transform-origin: 0 0; will-change: transform; }
.cn-lupas { position: absolute; right: 8px; bottom: 8px; display: flex; gap: 6px; z-index: 3; }
.cn-lupa {
  min-width: 52px; height: 48px; padding: 0 10px; border-radius: 999px; background: rgba(255, 255, 255, .94); color: var(--roxo-escuro);
  font-size: 19px; font-weight: 900; box-shadow: 0 4px 0 rgba(42, 26, 94, .3);
}
.cn-lupa:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 1px 0 rgba(42, 26, 94, .3); }

/* Respostas em botões grandes. */
.cn-escolhas { display: grid; grid-template-columns: repeat(var(--n), 1fr); gap: 10px; }
.cn-escolha {
  min-height: 72px; padding: 4px; border-radius: 22px; background: var(--roxo); color: #fff; box-shadow: 0 6px 0 var(--roxo-escuro);
  font-size: clamp(26px, 8vw, 44px); font-weight: 900; line-height: 1; text-shadow: 0 3px 0 rgba(0, 0, 0, .2);
}
.cn-escolha:nth-child(2) { background: #f97316; box-shadow: 0 6px 0 #c2410c; }
.cn-escolha:nth-child(3) { background: #0ea5e9; box-shadow: 0 6px 0 #0369a1; }
.cn-escolha:nth-child(4) { background: #ec4899; box-shadow: 0 6px 0 #be185d; }
.cn-escolha:active:not(:disabled) { transform: translateY(4px); }
.cn-respondido .cn-escolha { opacity: .4; }
.cn-respondido .cn-escolha.cn-certo { opacity: 1; background: #22c55e; box-shadow: 0 6px 0 #15803d, 0 0 0 5px #fff; animation: pula .4s cubic-bezier(.2, 1.6, .4, 1); }
.cn-respondido .cn-escolha.cn-errou { opacity: .9; background: #ef4444; box-shadow: 0 6px 0 #b91c1c; animation: treme .12s 4; }
.cn-conta {
  align-self: center; padding: 8px 18px; border-radius: 18px; background: #fff; border: 4px dashed #f59e0b;
  font-size: clamp(20px, 6vw, 28px); font-weight: 900; text-align: center; animation: pula .4s cubic-bezier(.2, 1.6, .4, 1);
}
.cn-conta small { display: block; font-size: 15px; font-weight: 700; opacity: .75; }

/* ---------- A casa dos três porquinhos ---------- */
.cn-lugares-casa .lugar-arte svg { width: 100%; height: 100%; }
.cn-trilha { display: flex; justify-content: center; gap: 6px; flex-wrap: wrap; }
.cn-trilha-item {
  width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font-size: 22px;
  background: rgba(255, 255, 255, .35); border: 3px solid transparent; position: relative;
}
.cn-trilha-item.cn-feita { background: #fff; }
.cn-trilha-item.cn-feita::after { content: "✔"; position: absolute; right: -4px; bottom: -4px; width: 18px; height: 18px; border-radius: 50%; background: #22c55e; color: #fff; font-size: 12px; display: grid; place-items: center; }
.cn-trilha-item.cn-agora-etapa { background: #fff; border-color: #fde047; animation: realce 1.2s ease-in-out infinite; }
.cn-cena {
  position: relative; width: 100%; max-width: min(620px, calc((100vh - 330px) * 1.44)); min-width: 260px; margin: 0 auto;
  border-radius: 24px; overflow: hidden; box-shadow: var(--sombra); touch-action: none; background: #bae6fd;
}
.cn-cena-svg { display: block; width: 100%; height: auto; touch-action: none; }
.cn-nuvem { animation: cn-nuvem 14s ease-in-out infinite alternate; }
.cn-nuvem2 { animation-duration: 18s; }
@keyframes cn-nuvem { to { transform: translateX(-40px); } }
.cn-casa-mexe { transform-box: fill-box; transform-origin: 50% 100%; }
.cn-vaga { fill: rgba(255, 255, 255, .25); stroke: #fff; stroke-width: 2.5; stroke-dasharray: 7 5; animation: cn-formiga .8s linear infinite; }
@keyframes cn-formiga { to { stroke-dashoffset: -24; } }
.cn-poe { animation: cn-poe .35s cubic-bezier(.2, 1.5, .4, 1); transform-box: fill-box; transform-origin: 50% 100%; }
@keyframes cn-poe { from { transform: translateY(-26px) scale(1.1); opacity: .2; } }
.cn-surge { animation: cn-surge .4s cubic-bezier(.2, 1.6, .4, 1); transform-box: fill-box; transform-origin: center; }
@keyframes cn-surge { from { transform: scale(.4); opacity: 0; } }
.cn-surge-suave { animation: aparece .4s ease-out; }
.cn-sujeira { transition: opacity .35s; }
.cn-sujeira.cn-some { opacity: 0; }
.cn-estaca { transition: transform .15s cubic-bezier(.3, 1.6, .5, 1); }
.cn-alvo-toque { cursor: pointer; }
.cn-alvo-anel { fill: rgba(253, 224, 71, .25); stroke: #fde047; stroke-width: 3; transform-box: fill-box; transform-origin: center; animation: cn-pulsa-alvo 1s ease-in-out infinite; }
@keyframes cn-pulsa-alvo { 50% { transform: scale(1.3); opacity: .55; } }
.cn-alvo-feito .cn-alvo-anel { display: none; }
.cn-alvo-feito { pointer-events: none; }
.cn-martelo-bate svg { transform-box: fill-box; transform-origin: 80% 90%; animation: cn-bate .35s ease-in; }
@keyframes cn-bate { 0% { transform: rotate(-50deg); } 60% { transform: rotate(8deg); } 100% { transform: rotate(0); } }
.cn-pof { animation: aparece .2s .15s backwards; }
.cn-ponta { pointer-events: none; }
.cn-bandeja { display: flex; justify-content: center; flex-wrap: wrap; gap: 10px; min-height: 76px; touch-action: none; }
.cn-peca-btn {
  position: relative; width: 72px; height: 72px; padding: 6px; border-radius: 20px; background: #fff; box-shadow: var(--sombra);
  border: 4px solid transparent; touch-action: none;
}
.cn-peca-btn svg { width: 100%; height: 100%; pointer-events: none; }
.cn-peca-btn.cn-usado { visibility: hidden; }
.cn-peca-btn.cn-escolhida { border-color: #fde047; transform: scale(1.08); }
.cn-peca-dourada { background: radial-gradient(circle, #fef9c3, #fde047); box-shadow: 0 0 0 3px #f59e0b, var(--sombra); animation: realce 1.4s ease-in-out infinite; }
.cn-fantasma-peca { padding: 6px; }

/* As falas na cena. */
.cn-fala {
  position: absolute; z-index: 4; max-width: 62%; padding: 7px 12px; border-radius: 16px; background: #fff; color: var(--tinta);
  font-size: clamp(14px, 4vw, 19px); font-weight: 800; line-height: 1.15; box-shadow: 0 4px 0 rgba(42, 26, 94, .25);
  animation: pula .3s cubic-bezier(.2, 1.6, .4, 1); pointer-events: none;
}
.cn-fala::after { content: ""; position: absolute; bottom: -14px; border: 7px solid transparent; border-top: 9px solid #fff; }
.cn-fala-lobo { right: 3%; top: 5%; }
.cn-fala-lobo::after { right: 34px; }
.cn-fala-porco { left: 8%; top: 12%; background: #fde68a; }
.cn-fala-porco::after { left: 40%; border-top-color: #fde68a; }

/* O lobo chegando e soprando. */
.cn-lobo-pos.cn-anda { transition: transform 1.2s cubic-bezier(.3, .9, .4, 1); }
.cn-lobo-pos.cn-anda .cn-lobo-arte { animation: cn-pula-anda .3s ease-in-out 4; }
@keyframes cn-pula-anda { 50% { transform: translateY(-6px); } }
.cn-rajadas path { fill: none; stroke: #fff; stroke-width: 5; stroke-linecap: round; stroke-dasharray: 18 14; opacity: 0; transition: opacity .2s; }
.cn-soprando .cn-rajadas path { opacity: .9; animation: cn-rajada .45s linear infinite; }
.cn-soprando .cn-rajadas path:nth-child(2) { animation-duration: .38s; }
.cn-soprando .cn-rajadas path:nth-child(3) { animation-duration: .52s; }
@keyframes cn-rajada { to { stroke-dashoffset: 64; } }
.cn-sopro { display: grid; grid-template-columns: 1fr auto; grid-template-rows: auto auto; gap: 6px 12px; align-items: center; width: 100%; max-width: 520px; }
.cn-vento-barra { position: relative; height: 28px; border-radius: 999px; background: rgba(255, 255, 255, .4); overflow: hidden; border: 3px solid #fff; }
.cn-vento-barra i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #a5f3fc, #0ea5e9); border-radius: 999px; }
.cn-vento-barra span { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); font-size: 18px; }
.cn-sopros { grid-row: 2; color: #fff; font-weight: 800; font-size: 16px; text-align: center; }
.cn-soprar {
  grid-column: 2; grid-row: 1 / span 2; width: 108px; height: 108px; border-radius: 50%; background: #0ea5e9; color: #fff; box-shadow: 0 8px 0 #0369a1;
  display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 18px; touch-action: none; border: 5px solid #fff;
}
.cn-soprar-emoji { font-size: 40px; line-height: 1; pointer-events: none; }
.cn-soprar b { pointer-events: none; }
.cn-soprar.cn-segurando { transform: translateY(6px) scale(.95); box-shadow: 0 2px 0 #0369a1, 0 0 0 10px rgba(14, 165, 233, .35); }
.cn-soprar.cn-segurando .cn-soprar-emoji { animation: treme .1s infinite; }
.cn-sacode { animation: cn-sacode .5s ease-in-out; }
@keyframes cn-sacode { 20% { transform: rotate(-3deg); } 40% { transform: rotate(3deg); } 60% { transform: rotate(-2deg); } 80% { transform: rotate(1deg); } }
.cn-fiapo { animation: cn-fiapo 1.1s ease-in forwards; }
@keyframes cn-fiapo { to { transform: translate(var(--dx), var(--dy)) rotate(260deg); opacity: 0; } }

/* O que o vento fez. */
.cn-voa { transform-box: fill-box; transform-origin: center; animation: cn-voa 1.5s var(--atraso, 0ms) cubic-bezier(.4, 0, .7, .4) forwards; }
@keyframes cn-voa { 30% { opacity: 1; } to { transform: translate(var(--dx), var(--dy)) rotate(var(--giro)); opacity: 0; } }
.cn-balanca { animation: cn-balanca 1.7s ease-in-out; }
@keyframes cn-balanca { 15% { transform: rotate(-2deg); } 35% { transform: rotate(3deg); } 55% { transform: rotate(-5deg); } 75% { transform: rotate(7deg); } 100% { transform: rotate(-4deg); } }
.cn-cai { transform-box: fill-box; transform-origin: 50% 100%; animation: cn-cai 1.1s var(--atraso, 0ms) cubic-bezier(.5, 0, .9, .5) forwards; }
@keyframes cn-cai { 60% { opacity: 1; } to { transform: translate(var(--dx), 70px) rotate(var(--giro)); opacity: 0; } }
.cn-correm { animation: cn-correm 1.8s ease-in forwards; }
@keyframes cn-correm { to { transform: translateX(-260px); } }
.cn-fumaca { animation: cn-fumaca 2.4s ease-in-out infinite; }
@keyframes cn-fumaca { 50% { transform: translate(4px, -4px); opacity: .6; } }
.cn-janela-amigos .janela-arte, .cn-janela-casa .janela-arte { width: min(320px, 76vw); }
.cn-janela-amigos .janela-arte svg, .cn-janela-casa .janela-arte svg { width: 100%; }

/* ---------- Monte a casa na ordem ---------- */
.cn-cartoes { display: grid; grid-template-columns: repeat(var(--n), 1fr); gap: 8px; touch-action: none; }
.cn-cartao {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 78px; padding: 6px 2px;
  border-radius: 18px; background: #fff; box-shadow: var(--sombra); border: 4px solid transparent; touch-action: none;
}
.cn-cartao-emoji { font-size: 34px; line-height: 1; pointer-events: none; }
.cn-cartao small { font-size: 14px; font-weight: 800; line-height: 1.05; text-align: center; pointer-events: none; }
.cn-cartao.cn-usado { visibility: hidden; }
.cn-cartao.cn-escolhida { border-color: #fde047; transform: scale(1.06); }
.cn-cartao-dourado { background: radial-gradient(circle, #fef9c3, #fde047); box-shadow: 0 0 0 3px #f59e0b, var(--sombra); }
.cn-cartao-dica { animation: cn-chama .7s ease-in-out infinite alternate; border-color: #22c55e; }
@keyframes cn-chama { to { transform: scale(1.08) rotate(-2deg); box-shadow: 0 0 0 6px rgba(34, 197, 94, .45), var(--sombra); } }
.cn-fantasma-cartao { border-radius: 18px; background: #fff; flex-direction: column; font-size: 34px; }
.cn-fantasma-cartao small { font-size: 13px; font-weight: 800; }
.cn-feitas { display: flex; justify-content: center; gap: 4px; min-height: 30px; flex-wrap: wrap; }
.cn-feita-item { width: 34px; height: 34px; border-radius: 50%; background: #fff; display: grid; place-items: center; font-size: 19px; animation: pula .3s cubic-bezier(.2, 1.6, .4, 1); }
.cn-surge-obra { animation: cn-poe .45s cubic-bezier(.2, 1.5, .4, 1); transform-box: fill-box; transform-origin: 50% 100%; }
.cn-tomba { transform-box: fill-box; transform-origin: 80% 100%; animation: cn-tomba 1.4s ease-in forwards; }
@keyframes cn-tomba {
  0% { transform: translateY(-70px); opacity: .9; }
  35% { transform: translateY(0); }
  45% { transform: translateY(-8px) rotate(4deg); }
  60% { transform: translateY(0) rotate(-6deg); }
  100% { transform: translate(60px, 90px) rotate(70deg); opacity: 0; }
}
.cn-proxima { opacity: .7; font-size: 16px; }

/* ---------- Torre de blocos ---------- */
.cn-torre-caixa {
  position: relative; width: 100%; height: min(54vh, 560px); min-height: 260px; border-radius: 24px; overflow: hidden;
  box-shadow: var(--sombra); background: #e0f2fe; touch-action: none;
}
.cn-torre-tela { display: block; touch-action: none; }
.cn-torre-fila { display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 62px; }
.cn-torre-fila-t { color: #fff; font-weight: 800; font-size: 17px; }
.cn-torre-op {
  width: 104px; height: 58px; border-radius: 16px; background: rgba(255, 255, 255, .85); border: 4px solid transparent;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; box-shadow: var(--sombra);
}
.cn-torre-op i { display: block; height: 18px; border-radius: 5px; background: var(--cor); border: 2px solid var(--tinta); }
.cn-torre-op small { font-size: 13px; font-weight: 800; }
.cn-torre-op.cn-escolhida { border-color: #fde047; background: #fff; }
.cn-torre-ouro i { background: #fbbf24; }

/* ---------- Ferramentas da obra ---------- */
.cn-mesa { position: relative; display: grid; grid-template-columns: 1fr 1fr; column-gap: 44px; }
.cn-col { display: flex; flex-direction: column; gap: 8px; position: relative; z-index: 1; }
.cn-linhas { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 2; overflow: visible; }
.cn-linha { animation: cn-traca .4s ease-out; stroke-dasharray: 600; }
@keyframes cn-traca { from { stroke-dashoffset: 600; } to { stroke-dashoffset: 0; } }
.cn-liga {
  display: flex; align-items: center; gap: 6px; min-height: calc(min(72px, (100vh - 330px) / var(--linhas, 5))); padding: 4px 8px; border-radius: 18px;
  background: #fff; box-shadow: var(--sombra); border: 4px solid transparent; text-align: left;
}
.cn-liga-arte { width: 52px; height: 52px; flex: none; display: block; }
.cn-liga-arte svg { width: 100%; height: 100%; display: block; }
.cn-liga small { font-size: 15px; font-weight: 800; line-height: 1.1; }
.cn-liga-uso { flex-direction: row-reverse; text-align: right; }
.cn-liga.cn-escolhida { border-color: #fde047; transform: scale(1.04); box-shadow: 0 0 0 4px rgba(253, 224, 71, .5), var(--sombra); }
.cn-liga.cn-ligado { border-color: var(--cor); background: color-mix(in srgb, var(--cor) 14%, #fff); }
.cn-liga-ouro { background: radial-gradient(circle, #fef9c3, #fde68a); }
.cn-tremendo { animation: treme .12s 4; border-color: #ef4444; }
.cn-trabalha .cn-liga-arte { animation: cn-trabalha .5s ease-in-out 3; }
@keyframes cn-trabalha { 50% { transform: translateY(5px) rotate(-6deg) scale(.95); } }
.cn-seguranca { gap: 8px; }
.cn-seguranca strong { font-size: 24px; text-align: center; }
.cn-seg-arte { width: 120px; height: 120px; margin: 0 auto; }
.cn-seg-arte svg { width: 100%; height: 100%; }
.cn-resp { font-size: 24px; }

/* ---------- A ponte aguenta? ---------- */
.cn-formas { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.cn-forma-caixa { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px; border-radius: 20px; background: #fff; box-shadow: var(--sombra); }
.cn-forma { width: 100%; max-width: 180px; display: block; touch-action: none; cursor: grab; }
.cn-forma-caixa b { font-size: 15px; text-align: center; }
.cn-subtitulo { margin: 0; color: #fff; text-align: center; font-size: 21px; }
.cn-modelos { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.cn-modelo { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 4px; border-radius: 18px; background: #fff; box-shadow: var(--sombra); }
.cn-modelo span { width: 100%; max-width: 110px; }
.cn-modelo svg { width: 100%; display: block; }
.cn-modelo b { font-size: 16px; }
.cn-modelo-triangulo { box-shadow: 0 0 0 4px #22c55e, var(--sombra); }
.cn-ponte-zoom { box-shadow: var(--sombra); background: #e0f2fe; }
.cn-ponte-svg { display: block; width: 100%; height: auto; touch-action: none; }
.cn-ondas { animation: cn-ondas 2.4s linear infinite; }
@keyframes cn-ondas { to { transform: translateX(-40px); } }
.cn-estrada { stroke: #374151; stroke-width: 12; stroke-linecap: round; }
.cn-barra { stroke: #64748b; stroke-width: 8; stroke-linecap: round; }
.cn-quebrou { stroke-dasharray: 10 8; stroke: #dc2626 !important; animation: brilha .5s infinite; }
.cn-fantasma-barra { stroke: #fff; stroke-width: 6; stroke-dasharray: 8 7; stroke-linecap: round; opacity: .95; animation: cn-formiga .8s linear infinite; }
.cn-toque-barra { stroke: transparent; stroke-width: 26; stroke-linecap: round; cursor: pointer; }
.cn-no { cursor: pointer; }
.cn-no-pino { fill: #facc15; stroke: #2a1a5e; stroke-width: 3; }
.cn-no-vazio .cn-no-pino { fill: #fff; opacity: .85; }
.cn-apoio .cn-no-pino { fill: #f97316; }
.cn-no-escolhido .cn-no-pino { fill: #22c55e; r: 13; stroke-width: 4; }
.cn-no-escolhido circle:first-child { fill: rgba(34, 197, 94, .3); }
.cn-ponte-barra { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px; min-height: 60px; }
.cn-pecas { padding: 6px 14px; border-radius: 999px; background: #fff; font-size: 17px; }
.cn-pecas-fim { background: #fed7aa; color: #9a3412; }
.cn-acelera { background: #f97316; box-shadow: 0 8px 0 #c2410c; }
.cn-acelera.cn-segurando { box-shadow: 0 2px 0 #c2410c, 0 0 0 10px rgba(249, 115, 22, .35); }
.cn-aqui { fill: rgba(239, 68, 68, .15); stroke: #ef4444; stroke-width: 5; stroke-dasharray: 10 6; transform-box: fill-box; transform-origin: center; animation: cn-pulsa-alvo 1s ease-in-out infinite; }
.cn-aqui-t { font: 900 22px var(--letra); fill: #b91c1c; stroke: #fff; stroke-width: 5; paint-order: stroke; }
.cn-escolhas-longas .cn-escolha { font-size: clamp(18px, 5.4vw, 30px); min-height: 64px; }
@media (max-width: 420px) { .cn-escolhas-longas[style*="--n: 4"] { grid-template-columns: 1fr 1fr; } }
.cn-resultado { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.cn-conta-errou { border-color: #f97316; }

/* ---------- Planta da casa ---------- */
.cn-planta-caixa { border-radius: 20px; overflow: hidden; background: #fff; box-shadow: var(--sombra); padding: 4px; touch-action: none; }
.cn-planta { display: block; width: 100%; height: auto; max-height: 52vh; touch-action: none; }
.cn-grade { stroke: rgba(21, 128, 61, .25); stroke-width: 1; }
.cn-comodo { cursor: grab; }
.cn-comodo-fundo { stroke: #2a1a5e; stroke-width: 2.5; }
.cn-comodo-sel .cn-comodo-fundo { stroke: #6d4ce0; stroke-width: 4; }
.cn-comodo-emoji { text-anchor: middle; dominant-baseline: middle; pointer-events: none; }
.cn-comodo-txt { text-anchor: middle; font: 900 13px var(--letra); fill: #2a1a5e; pointer-events: none; }
.cn-alca { cursor: nwse-resize; }
.cn-alca-bola { fill: #6d4ce0; stroke: #fff; stroke-width: 3; }
.cn-planta-info { display: flex; flex-direction: column; gap: 4px; color: #fff; font-weight: 700; text-align: center; }
.cn-planta-sel { display: flex; flex-direction: column; gap: 2px; padding: 8px 12px; border-radius: 16px; background: #fff; color: var(--tinta); border-left: 10px solid var(--cor); font-size: 17px; text-align: left; }
.cn-planta-sel strong { font-size: 19px; }
.cn-planta-sel b { color: var(--roxo-escuro); }
.cn-custo-alto { color: #fecaca; }
.cn-pedidos { list-style: none; margin: 0; padding: 8px 12px; border-radius: 16px; background: rgba(255, 255, 255, .9); display: grid; gap: 2px; font-size: 16px; font-weight: 700; }
.cn-pedidos li.cn-ok { color: #15803d; }
.cn-pergunta p { margin: 0; font-size: 21px; font-weight: 800; line-height: 1.3; text-align: center; }

/* ---------- Quantos tijolos? ---------- */
.cn-enunciado { font-size: 20px; display: flex; align-items: center; justify-content: center; gap: 12px; }
.cn-fracao { display: inline-flex; flex-direction: column; align-items: center; font-size: 30px; line-height: 1; color: var(--roxo-escuro); flex: none; }
.cn-fracao i { display: block; width: 28px; height: 4px; margin: 3px 0; background: currentColor; border-radius: 2px; }
.cn-parede-caixa { padding: 10px; border-radius: 20px; background: linear-gradient(#bae6fd, #e0f2fe 70%, #86efac 70%); box-shadow: var(--sombra); touch-action: none; display: flex; justify-content: center; }
.cn-parede { display: block; width: 100%; max-width: 460px; max-height: 38vh; touch-action: none; }
.cn-parede-pilha { gap: 6px; }
.cn-parede-pilha svg { width: 28%; max-width: 120px; }
.cn-tij { stroke: #7f1d1d; stroke-width: 1.6; cursor: pointer; transition: fill .15s; }
.cn-tij-vazio { stroke: #fff; stroke-dasharray: 4 3; stroke-width: 1.6; }
.cn-tij-contado { filter: brightness(1.25); stroke: #fde047; stroke-width: 2.5; }
.cn-tij-pintado { fill: #a855f7 !important; stroke: #581c87; }
.cn-tij-num { font: 900 13px var(--letra); fill: #fff; stroke: #2a1a5e; stroke-width: 3; paint-order: stroke; text-anchor: middle; }
.cn-rotulo { font: 800 12px var(--letra); fill: #2a1a5e; text-anchor: middle; }

.cn-cena-menor { max-width: min(620px, calc((100vh - 400px) * 1.44)); }
.cn-mesa[style*="--linhas: 7"] .cn-liga-arte { width: 42px; height: 42px; }
.cn-mesa[style*="--linhas: 7"] .cn-liga { padding: 2px 6px; }
.cn-mesa[style*="--linhas: 7"] .cn-col { gap: 6px; }

/* ---------- v5: o que foi praticado, o mapa da vila e a TV ---------- */
.cn-praticou { align-self: stretch; margin: 4px 0 0; padding: 8px 14px; border-radius: 16px; background: rgba(255, 255, 255, .92); box-shadow: var(--sombra); font-size: 16px; font-weight: 700; line-height: 1.35; text-align: center; }
.cn-praticou strong { color: var(--roxo-escuro); }
.cn-gestos-lista { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.cn-gestos-lista .cn-gesto { font-size: 16px; padding: 4px 12px 4px 8px; }
.cn-gestos-lista .cn-mao { font-size: 24px; }
/* Só no modo TV: a alternativa de botão para os gestos de passar o dedo (o controle remoto não desliza). */
.cn-so-tv { display: none; }
body.modo-tv .cn-so-tv { display: inline-flex; }

/* O mapa da vila (as fases da aventura). */
.cn-mapa-topo { display: flex; align-items: center; gap: 10px; }
.cn-mapa-arte { width: 92px; flex: none; animation: balanca 2.6s ease-in-out infinite; }
.cn-mapa-arte svg { display: block; width: 100%; height: auto; }
.cn-mapa-fala {
  position: relative; flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; padding: 10px 14px; border-radius: 20px;
  background: #fff; box-shadow: var(--sombra); line-height: 1.25;
}
.cn-mapa-fala::before { content: ""; position: absolute; left: -10px; top: 34px; border: 10px solid transparent; border-right-color: #fff; border-left: 0; }
.cn-mapa-fala p { margin: 0; font-size: 15px; font-weight: 700; opacity: .8; }
.cn-mapa-fala strong { font-size: 19px; color: var(--roxo-escuro); }
.cn-mapa-fala span { font-size: 15px; font-weight: 700; }
.cn-mapa-fala small { font-size: 13px; font-weight: 700; opacity: .7; }
.cn-mapa-completo { font-size: 15px; color: #a16207; }
.cn-mapa {
  position: relative; padding: 14px 10px; border-radius: 24px; overflow: hidden;
  background: radial-gradient(circle at 20% 15%, rgba(255, 255, 255, .35) 0 30px, transparent 31px), linear-gradient(#86efac, #4ade80);
  box-shadow: inset 0 -8px 0 rgba(21, 128, 61, .25), var(--sombra);
}
.cn-mapa-trilha {
  position: relative; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px 8px;
  background: linear-gradient(transparent calc(50% - 7px), #d6a76b calc(50% - 7px), #d6a76b calc(50% + 7px), transparent calc(50% + 7px));
}
@media (min-width: 820px) { .cn-mapa-trilha { grid-template-columns: repeat(8, minmax(0, 1fr)); } }
.cn-fase {
  position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 2px 8px; min-height: 112px;
  border-radius: 20px; background: rgba(255, 255, 255, .94); box-shadow: 0 5px 0 rgba(21, 128, 61, .45); border: 4px solid transparent;
}
.cn-fase:disabled { background: rgba(255, 255, 255, .55); box-shadow: none; opacity: 1; filter: grayscale(.4); }
.cn-fase-bola {
  position: relative; width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center;
  background: #fde68a; border: 4px solid #f59e0b; font-size: 24px; font-weight: 900; color: #78350f;
}
.cn-fase-bola b { font-size: 26px; line-height: 1; }
.cn-fase-bola i { position: absolute; right: -10px; bottom: -6px; font-size: 22px; font-style: normal; }
.cn-fase-bola svg { width: 100%; height: 100%; display: block; }
.cn-fase:disabled .cn-fase-bola { background: #e5e7eb; border-color: #9ca3af; }
.cn-fase-estrelas { font-size: 17px; letter-spacing: 1px; color: #f59e0b; text-shadow: 0 1px 0 #78350f; min-height: 20px; }
.cn-fase small { font-size: 13px; font-weight: 800; line-height: 1.1; text-align: center; }
.cn-fase-feita .cn-fase-bola { background: #bbf7d0; border-color: #16a34a; color: #14532d; }
.cn-fase-chefao .cn-fase-bola { width: 66px; height: 66px; margin-top: -6px; background: #fecaca; border-color: #dc2626; overflow: hidden; }
.cn-fase-chefao.cn-fase-feita .cn-fase-bola { background: #fbcfe8; border-color: #db2777; }
.cn-fase-atual { border-color: #fde047; animation: realce 1.2s ease-in-out infinite; }
.cn-mapa-botoes { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 10px; }
.cn-proxima { animation: pula .5s cubic-bezier(.2, 1.6, .4, 1); }

/* O detetive dos materiais e o orçamento (antes da obra). */
.cn-detetive { flex-direction: row; align-items: center; gap: 10px; }
.cn-detetive-arte { width: 74px; flex: none; }
.cn-detetive-arte svg { display: block; width: 100%; height: auto; }
.cn-materiais { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.cn-material, .cn-loja-item {
  display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 4px 10px; border-radius: 20px;
  background: #fff; box-shadow: var(--sombra); border: 4px solid transparent; font-size: 18px;
}
.cn-material-arte { width: 72px; height: 72px; display: grid; place-items: center; }
.cn-material-arte svg { width: 100%; height: 100%; display: block; }
.cn-material b, .cn-loja-item b { font-size: 19px; }
.cn-material.cn-certo, .cn-loja-item.cn-certo { border-color: #22c55e; background: #dcfce7; animation: pula .4s cubic-bezier(.2, 1.6, .4, 1); opacity: 1; }
.cn-material.cn-errou, .cn-loja-item.cn-errou { border-color: #ef4444; background: #fee2e2; animation: treme .12s 4; }
.cn-material:disabled:not(.cn-certo):not(.cn-errou) { opacity: .5; }
.cn-carteira {
  align-self: center; display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 4px 8px; padding: 8px 16px; border-radius: 18px;
  background: #fef3c7; border: 3px solid #f59e0b; font-size: 18px; font-weight: 800;
}
.cn-carteira b { font-size: 24px; color: #92400e; }
.cn-moedas { flex-basis: 100%; text-align: center; font-size: 18px; letter-spacing: -2px; line-height: 1.2; word-break: break-all; }
.cn-loja { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
@media (max-width: 520px) { .cn-loja { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.cn-loja-item small { font-size: 14px; font-weight: 800; }
.cn-loja-total { font-size: 15px; font-weight: 900; color: var(--roxo-escuro); }
.cn-loja-emoji { font-size: 52px; line-height: 1; }
.cn-loja-item.cn-cartao-dica { border-color: #22c55e; }

/* O segredo do triângulo: os cantos para ligar e as tábuas na diagonal. */
.cn-canto .cn-alvo-anel { stroke: #f97316; }
.cn-canto-escolhido .cn-alvo-anel { stroke: #22c55e; stroke-width: 5; fill: rgba(34, 197, 94, .3); }
.cn-fio-ligar { stroke: #22c55e; stroke-width: 5; stroke-dasharray: 8 6; stroke-linecap: round; pointer-events: none; }

/* Torre: o bloco de pedra na fila. */
.cn-torre-pedra i { background-image: radial-gradient(circle, rgba(255, 255, 255, .35) 2px, transparent 3px) !important; background-size: 10px 10px !important; }

/* Ponte (Desafio): a barra da pergunta, as respostas e a legenda das forças. */
.cn-barra-pergunta { stroke-width: 14 !important; animation: cn-pisca-barra .55s ease-in-out infinite alternate; }
@keyframes cn-pisca-barra { from { stroke-opacity: 1; } to { stroke-opacity: .35; } }
.cn-forca-op { font-size: 18px; }
.cn-forca-op:disabled { opacity: .55; }
.cn-forca-op.cn-certo:disabled, .cn-forca-op.cn-errou:disabled { opacity: 1; }
.cn-forca-op.cn-certo { background: #22c55e; color: #fff; box-shadow: 0 6px 0 #15803d; }
.cn-forca-op.cn-errou { background: #ef4444; color: #fff; box-shadow: 0 6px 0 #b91c1c; }
.cn-legenda-forca { display: block; margin-top: 4px; font-size: 15px; }
.cn-legenda-forca i { display: inline-block; width: 22px; height: 7px; border-radius: 4px; vertical-align: middle; }
.cn-azul { background: #2563eb; }
.cn-vermelho { background: #dc2626; }
.cn-apoio-t { font: 900 14px var(--letra); fill: #fff; stroke: #7c2d12; stroke-width: 3.5; paint-order: stroke; }

/* Planta: escolher o cômodo e mexer com botões (TV e precisão). */
.cn-planta-comodos { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
.cn-chip-comodo { padding: 4px 12px; border-radius: 999px; background: var(--cor); border: 3px solid transparent; font-size: 15px; font-weight: 800; color: #2a1a5e; }
.cn-chip-sel { border-color: var(--roxo); box-shadow: 0 0 0 3px rgba(109, 76, 224, .3); }
.cn-planta-pad { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 6px; max-width: 520px; margin: 0 auto; width: 100%; }
@media (max-width: 460px) { .cn-planta-pad { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.cn-pad { min-height: 42px; border-radius: 14px; background: #fff; box-shadow: 0 4px 0 rgba(42, 26, 94, .25); font-size: 18px; font-weight: 900; color: var(--roxo-escuro); }
.cn-pad:active { transform: translateY(3px); box-shadow: 0 1px 0 rgba(42, 26, 94, .25); }

/* Na TV (de longe): letras e alvos maiores. */
body.modo-tv .cn-fase { min-height: 132px; }
body.modo-tv .cn-fase small { font-size: 16px; }
body.modo-tv .cn-mapa-fala strong { font-size: 24px; }
body.modo-tv .cn-mapa-fala p, body.modo-tv .cn-mapa-fala span, body.modo-tv .cn-mapa-completo { font-size: 19px; }
body.modo-tv .cn-fase-estrelas { font-size: 22px; }
body.modo-tv .cn-praticou { font-size: 19px; }
body.modo-tv .cn-material b, body.modo-tv .cn-loja-item b { font-size: 24px; }
body.modo-tv .cn-pad { min-height: 54px; font-size: 22px; }
