/* Fazenda do Gemalino: estilos dos minijogos 4 a 7 e dos botões novos do menu.
   As cores e medidas (--alvo, --topo, --sombra...) vêm de estilo.css. */

/* ---------- botões novos do menu ---------- */
.btn-prato { width: 100%; height: 100%; object-fit: contain; }
.btn-dentes { width: 100%; height: 100%; object-fit: cover; border-radius: 18px; object-position: 45% 70%; }
.mini-roupas { position: relative; width: 100%; height: 100%; }
.mini-roupas img { position: absolute; bottom: 0; height: 96%; }
.mini-roupas img:first-child { left: -6%; transform: rotate(-6deg); }
.mini-roupas img:last-child { right: -6%; transform: rotate(6deg); }
.btn-cante-gemalino { width: 100%; height: 100%; min-height: 0; object-fit: contain; }
.notas { position: absolute; right: 6%; top: 4%; font-size: calc(var(--bj) * 0.3); line-height: 1; }

/* ---------- fundos ---------- */
.ceu-cozinha {
  background:
    linear-gradient(transparent 72%, #c8935b 72%, #b07a45 100%),
    repeating-linear-gradient(90deg, #fff3e0 0 60px, #ffe9cc 60px 120px);
}
.ceu-banheiro {
  background:
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.55) 0 2px, transparent 2px 64px),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.55) 0 2px, transparent 2px 64px),
    linear-gradient(#bfe9e3, #d9f3ee);
}

/* ---------- Minijogo 4: Cozinha ---------- */
.cozinha-escolha {
  left: 16px;
  right: 16px;
  top: var(--topo);
  bottom: calc(var(--alvo) + 16px);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(14px, 4cqw, 48px);
  flex-wrap: wrap;
}
.btn-prato-escolha {
  width: clamp(120px, 26cqmin, 260px);
  height: clamp(120px, 26cqmin, 260px);
  border-radius: 28px;
  background: var(--branco);
  box-shadow: var(--sombra);
  padding: 14px;
  animation: balancar 3s ease-in-out infinite;
}
.btn-prato-escolha:nth-child(2) { animation-delay: 0.5s; }
.btn-prato-escolha, .btn-roupa { display: grid; grid-template: 100% / 100%; place-items: center; }
.btn-prato-escolha img { width: 100%; height: 100%; min-height: 0; object-fit: contain; }

.cozinha-preparo {
  left: calc(var(--alvo) + 20px);
  right: 16px;
  top: var(--topo);
  bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: space-around;
  gap: 2cqw;
}
.cozinha-preparo[hidden], .cozinha-escolha[hidden], .cozinha-pronto[hidden] { display: none; }
.ingredientes {
  display: grid;
  grid-template-columns: repeat(2, auto);
  gap: 12px;
}
.ingrediente {
  width: clamp(var(--alvo), 14cqmin, 130px);
  height: clamp(var(--alvo), 14cqmin, 130px);
  border-radius: 22px;
  background: var(--branco);
  box-shadow: var(--sombra);
  padding: 12px;
  touch-action: none;
}
.ingrediente svg { width: 100%; height: 100%; }
.ingrediente.usado { visibility: hidden; }
.ingrediente:not(.usado) { animation: balancar 2.6s ease-in-out infinite; }

.tigela {
  position: relative;
  width: min(34cqw, 58cqh, 380px);
  aspect-ratio: 200 / 130;
  touch-action: none;
  transition: transform 0.9s ease-in, opacity 0.9s ease-in;
}
.tigela svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.tigela .massa {
  position: absolute;
  left: 8%;
  right: 8%;
  top: 16%;
  height: 30%;
  border-radius: 50%;
  overflow: hidden;
  opacity: var(--nivel, 0);
  transition: opacity 0.4s;
}
.tigela .massa::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 120%;
  aspect-ratio: 1;
  background: repeating-conic-gradient(#ffe08a 0 18deg, #f2c14e 18deg 36deg);
  transform: translate(-50%, -50%) rotate(var(--giro, 0deg));
}
.tigela.recebeu { animation: pulo 0.5s ease-out; }
.tigela.mexendo { filter: drop-shadow(0 0 14px #ffd23f); cursor: grab; }
.tigela.mexendo::after {
  content: "↻";
  position: absolute;
  right: -6%;
  top: -12%;
  font-size: clamp(40px, 8cqmin, 70px);
  color: var(--azul-marinho);
  animation: girar-dica 1.6s linear infinite;
}
@keyframes girar-dica { to { transform: rotate(360deg); } }
.tigela.no-fogo { transform: translateX(45%) scale(0.4); opacity: 0; }

.cozinha-fogao { display: flex; align-items: flex-end; gap: 8px; height: 80%; }
.galinha-cozinha { height: min(100%, 46cqh); transform-origin: 50% 100%; }
.galinha-cozinha.levando { animation: pulo 0.7s ease-out 3; }
.fogao { width: clamp(110px, 18cqmin, 200px); }
.fogao svg { width: 100%; height: auto; display: block; }
.fogao.cozinhando .janela-forno { animation: brasa 0.8s ease-in-out infinite alternate; }
@keyframes brasa { from { fill: #ff9f43; } to { fill: #ffd23f; } }

.cozinha-pronto {
  left: 16px;
  right: 16px;
  top: var(--topo);
  bottom: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2cqh;
}
.prato-pronto { max-height: 46%; max-width: 70cqw; animation: pulo 0.8s ease-out; }
.comendo { display: flex; align-items: flex-end; gap: 3cqw; height: 32%; }
.comendo img { height: 100%; animation: pulo 0.7s ease-out infinite; }
.comendo img:nth-child(2) { animation-delay: 0.15s; height: 60%; }
.comendo img:nth-child(3) { animation-delay: 0.3s; height: 30%; }
.comendo img:nth-child(4) { animation-delay: 0.45s; height: 60%; }

/* ---------- Minijogo 5: Vista o Gemalino ---------- */
.vestir-area {
  left: calc(var(--alvo) + 20px);
  right: calc(var(--alvo) + 40px);
  top: var(--topo);
  bottom: calc(clamp(var(--alvo), 15cqmin, 140px) + 28px);
  display: flex;
  justify-content: center;
  align-items: flex-end;
}
.vestir-gemalino { height: 100%; max-width: 100%; object-fit: contain; transform-origin: 50% 100%; }
.vestir-gemalino.pose-pulo { animation: pulo 0.8s ease-out; }
.vestir-gemalino.pose-gira { animation: pose-gira 0.9s ease-in-out; }
.vestir-gemalino.pose-balanca { animation: danca 0.6s ease-in-out 2; }
@keyframes pose-gira {
  0%, 100% { transform: scaleX(1); }
  25% { transform: scaleX(0.2); }
  50% { transform: scaleX(-1); }
  75% { transform: scaleX(0.2); }
}
.roupas {
  left: calc(var(--alvo) + 20px);
  right: 16px;
  bottom: 14px;
  display: flex;
  justify-content: center;
  gap: clamp(8px, 2cqw, 20px);
}
.btn-roupa {
  width: clamp(var(--alvo), 15cqmin, 140px);
  height: clamp(var(--alvo), 15cqmin, 140px);
  border-radius: 22px;
  background: var(--branco);
  box-shadow: var(--sombra);
  border: 5px solid transparent;
  padding: 6px;
}
.btn-roupa img { width: 100%; height: 100%; min-height: 0; object-fit: contain; }
.btn-roupa.escolhida { border-color: var(--amarelo); transform: translateY(-6px); }
.btn-foto {
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  width: clamp(var(--alvo), 14cqmin, 130px);
  height: clamp(var(--alvo), 14cqmin, 130px);
  border-radius: 50%;
  background: var(--amarelo);
  box-shadow: var(--sombra);
  font-size: clamp(40px, 7cqmin, 64px);
}
.flash { position: fixed; inset: 0; background: #fff; opacity: 0; pointer-events: none; z-index: 40; }
.flash.piscando { animation: flash 0.6s ease-out; }
@keyframes flash { 0% { opacity: 1; } 100% { opacity: 0; } }
.foto {
  position: fixed !important;
  inset: 0;
  z-index: 39;
  background: rgba(20, 30, 60, 0.55);
  display: grid;
  place-items: center;
  padding: 16px;
}
.foto[hidden] { display: none; }
.foto-moldura {
  display: block;
  background: #fff;
  padding: 14px 14px 56px;
  border-radius: 6px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
  transform: rotate(-3deg);
  background-image: linear-gradient(#cbeafd, #e8f6ff);
  background-clip: content-box;
}
.foto-moldura img { display: block; height: min(62cqh, 520px); max-width: 80cqw; object-fit: contain; }
.foto.revelando .foto-moldura { animation: revelar 0.6s ease-out; }
@keyframes revelar { from { transform: rotate(-12deg) scale(0.3); opacity: 0; } to { transform: rotate(-3deg) scale(1); opacity: 1; } }

/* ---------- Minijogo 6: Hora de escovar ---------- */
.escovar-area {
  left: calc(var(--alvo) + 20px);
  right: 16px;
  top: var(--topo);
  bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3cqw;
}
.boca {
  position: relative;
  height: 100%;
  max-width: 62cqw;
  aspect-ratio: 760 / 720;
  border-radius: 26px;
  overflow: hidden;
  border: 6px solid var(--branco);
  box-shadow: var(--sombra);
  touch-action: none;
}
.boca img { width: 100%; height: 100%; object-fit: cover; }
.manchas, .espuma { position: absolute; inset: 0; pointer-events: none; }
.mancha {
  position: absolute;
  width: 4.4%;
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(190, 150, 50, 0.95) 0 40%, rgba(190, 150, 50, 0.55) 58%, transparent 72%);
  transition: opacity 0.2s;
}
.mancha.da-vez { animation: chamar 1.2s ease-in-out infinite; }
.mancha.limpa { opacity: 0 !important; animation: none; }
@keyframes chamar { 0%, 100% { transform: translate(-50%, -50%) scale(1); } 50% { transform: translate(-50%, -50%) scale(1.25); } }
.espuma i {
  position: absolute;
  width: 5%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #fff 0 40%, rgba(255, 255, 255, 0.7) 60%, rgba(220, 240, 255, 0.4) 100%);
  transform: translate(-50%, -50%);
  animation: bolha 1.4s ease-out forwards;
}
@keyframes bolha { from { transform: translate(-50%, -50%) scale(0.4); opacity: 1; } to { transform: translate(-50%, -130%) scale(1.4); opacity: 0; } }
.boca.brilhando::after {
  content: "✨ ✨ ✨";
  position: absolute;
  left: var(--dentes-x, 30%);
  width: var(--dentes-w, 40%);
  top: var(--dentes-y, 60%);
  margin-top: -0.6em;
  text-align: center;
  white-space: nowrap;
  font-size: clamp(30px, 7cqmin, 60px);
  animation: aparecer 0.4s ease-out, pulo 0.8s ease-out 0.4s 2;
}
.escovar-ferramentas { display: flex; flex-direction: column; align-items: center; gap: 18px; }
.btn-pasta {
  width: clamp(110px, 17cqmin, 160px);
  height: clamp(var(--alvo), 12cqmin, 120px);
  border-radius: 22px;
  background: var(--branco);
  box-shadow: var(--sombra);
  padding: 8px;
  flex-shrink: 0;
  min-height: var(--alvo);
}
.btn-pasta svg { width: 100%; height: 100%; }
.btn-pasta.chamando { animation: pulo 1s ease-out infinite; }
.btn-pasta:disabled { opacity: 0.5; cursor: default; }
.escova { position: relative; width: clamp(110px, 17cqmin, 170px); pointer-events: none; }
.escova svg { width: 100%; height: auto; display: block; }
.escova.com-pasta::after {
  content: "";
  position: absolute;
  left: 80%;
  top: 4%;
  width: 11%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #fff, #9ed8ff);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}
.escova.esfregando { position: fixed; z-index: 30; transform: translate(-85%, -50%) rotate(-8deg); }

/* ---------- Minijogo 7: Cante com o Gemalino ---------- */
.palco {
  left: 10px;
  right: 0;
  bottom: 0;
  height: 60cqh;
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: 1cqw;
}
.dancarino {
  height: 40%;
  min-width: var(--alvo);
  min-height: var(--alvo);
  padding: 0;
  background: none;
  display: flex;
  align-items: flex-end;
  transform-origin: 50% 100%;
}
.dancarino img { height: 100%; width: auto; }
.dancarino-gemalino { height: 90%; }
.dancarino-bia { height: 18%; margin-bottom: 18%; }
.palco.tocando .dancarino { animation: danca 0.8s ease-in-out infinite; }
.palco.tocando .dancarino:nth-child(2n) { animation-delay: 0.2s; }
.palco.tocando .dancarino:nth-child(3n) { animation-delay: 0.4s; }
.dancarino.passo-pulo { animation: pulo 0.7s ease-out !important; }
.dancarino.passo-gira { animation: pose-gira 0.8s ease-in-out !important; }
.dancarino.passo-lado { animation: passo-lado 0.7s ease-in-out !important; }
@keyframes passo-lado {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-18%) rotate(-6deg); }
  75% { transform: translateX(18%) rotate(6deg); }
}
.lista-musicas {
  right: 16px;
  top: var(--topo);
  display: grid;
  grid-template-columns: repeat(2, auto);
  gap: 10px;
}
.btn-musica-palco {
  position: relative;
  width: clamp(150px, 19cqmin, 200px);
  height: clamp(var(--alvo), 10.7cqmin, 112px);
  border-radius: 16px;
  overflow: hidden;
  border: 5px solid var(--branco);
  box-shadow: var(--sombra);
  padding: 0;
  background: #cbeafd;
}
.btn-musica-palco img { width: 100%; height: 100%; object-fit: cover; }
.btn-musica-palco .tocar {
  position: absolute;
  right: 6px;
  bottom: 6px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--verde-escuro);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 18px;
}
.btn-musica-palco.ativa { border-color: var(--amarelo); animation: pulo 1s ease-out infinite; }
.btn-musica-palco.ativa .tocar::before { content: "■"; }
.btn-musica-palco.ativa .tocar { font-size: 0; }
.btn-musica-palco.ativa .tocar::before { font-size: 18px; }
.instrumentos {
  left: max(10px, env(safe-area-inset-left));
  top: var(--topo);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.btn-instrumento {
  width: var(--alvo);
  height: var(--alvo);
  border-radius: 50%;
  background: var(--branco);
  box-shadow: var(--sombra);
  padding: 12px;
}
.btn-instrumento svg { width: 100%; height: 100%; }
.btn-instrumento.batida { animation: batida 0.25s ease-out; }
@keyframes batida { 50% { transform: scale(1.2) rotate(-8deg); } }
.letra { display: none; }
body.com-letra .letra:not(:empty) {
  display: block;
  left: calc(var(--alvo) + 30px);
  top: var(--topo);
  width: min(36cqw, 420px);
  max-height: 42cqh;
  overflow: auto;
  padding: 12px 16px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--sombra);
  font-size: clamp(15px, 2.2cqmin, 20px);
  font-weight: 700;
  z-index: 18;
}
.letra p { margin: 0; }
.letra p.estrofe { height: 0.7em; }
/* botão de fechar: grudado no canto de cima, não some quando a letra rola */
.letra-fechar {
  position: sticky;
  top: 0;
  float: right;
  width: var(--alvo);
  height: var(--alvo);
  margin: -4px -8px 4px 8px;
  border-radius: 50%;
  background: var(--branco);
  color: var(--azul-marinho);
  box-shadow: var(--sombra);
  padding: 22px;
  z-index: 2;
}
.letra-fechar svg { width: 100%; height: 100%; display: block; }
body.com-letra .letra.fechada:not(:empty), .letra.fechada { display: none; }

/* ---------- celular em pé ---------- */
@media (orientation: portrait) {
  .cozinha-escolha { top: calc(var(--topo) + 96px); flex-direction: column; }
  .cozinha-preparo {
    left: 16px;
    top: calc(var(--topo) + 96px);
    bottom: calc(var(--alvo) + 20px);
    flex-wrap: wrap;
    align-content: space-around;
  }
  .ingredientes { flex: 0 0 100%; justify-content: center; grid-template-columns: repeat(2, auto); }
  .ingrediente { width: var(--alvo); height: var(--alvo); }
  .tigela { width: min(54cqw, 300px); }
  .cozinha-fogao { height: 22cqh; }
  .cozinha-pronto { top: calc(var(--topo) + 96px); bottom: calc(var(--alvo) + 20px); }

  .vestir-area { left: 16px; right: 16px; top: calc(var(--topo) + 96px); bottom: calc(2 * var(--alvo) + 60px); }
  .roupas { left: 16px; bottom: calc(var(--alvo) + 24px); flex-wrap: wrap; }
  .btn-roupa { width: var(--alvo); height: var(--alvo); }
  .btn-foto { top: auto; bottom: 14px; right: 16px; transform: none; }

  .escovar-area { left: 16px; top: calc(var(--topo) + 96px); bottom: calc(var(--alvo) + 20px); flex-direction: column; }
  .boca { height: auto; width: 100%; max-width: none; }
  .escovar-ferramentas { flex-direction: row; }

  .palco { left: 0; height: 42cqh; gap: 0; }
  .dancarino + .dancarino { margin-left: -26px; }
  .lista-musicas { left: 16px; right: 16px; top: calc(var(--topo) + 96px); justify-content: center; }
  .btn-musica-palco { width: clamp(140px, 42cqw, 200px); }
  .instrumentos { left: 50%; top: auto; bottom: 44cqh; transform: translateX(-50%); flex-direction: row; }
  body.com-letra .letra:not(:empty) { width: auto; left: 16px; right: 16px; transform: none; top: calc(var(--topo) + 96px + 2 * var(--alvo) + 30px); max-height: 18cqh; }
}

/* ---------- celular deitado (telas baixas) ---------- */
@media (orientation: landscape) and (max-height: 500px) {
  .cozinha-preparo { top: 100px; bottom: 6px; }
  .ingrediente { width: var(--alvo); height: var(--alvo); padding: 10px; }
  .ingredientes { gap: 6px; }
  .btn-prato-escolha { width: 150px; height: 150px; }
  /* Vestir: Gemalino à esquerda; roupas em 3 colunas x 2 fileiras abaixo do balão; câmera à direita */
  .vestir-area { top: 70px; bottom: 6px; left: 8px; right: calc(4 * var(--alvo) + 66px); }
  .roupas {
    left: auto; right: calc(var(--alvo) + 30px); bottom: 50%; transform: translateY(50%);
    display: grid; grid-template-columns: repeat(3, var(--alvo)); gap: 8px; width: auto;
  }
  .btn-roupa { width: var(--alvo); height: var(--alvo); }
  .btn-roupa.escolhida { transform: none; }
  .escovar-area { top: 72px; bottom: 6px; }
  /* Cante: à direita, de cima para baixo, as 4 músicas (2x2) e os 3 instrumentos; os bonecos e a letra ficam à esquerda */
  .lista-musicas { top: 8px; right: 8px; gap: 6px; }
  .btn-musica-palco { width: 150px; height: var(--alvo); }
  .instrumentos { left: auto; right: 8px; top: calc(8px + 2 * var(--alvo) + 14px); bottom: auto; flex-direction: row; gap: 8px; }
  .palco { left: 8px; right: 340px; height: 62cqh; gap: 0; }
  .dancarino { min-width: 0; }  /* os 5 bonecos têm de caber na caixa do palco (não passar para baixo da barra) */
  .dancarino + .dancarino { margin-left: -28px; }
  body.com-letra .letra:not(:empty) { left: 8px; top: 72px; width: calc(100cqw - 340px - 16px); max-height: calc(100cqh - 80px); }
}

/* ---------- Cozinha (revisão de design): tudo maior, ocupando a bancada ---------- */
@media (orientation: landscape) and (min-height: 501px) {
  .btn-prato-escolha { width: clamp(140px, 34cqmin, 300px); height: clamp(140px, 34cqmin, 300px); }
  .ingrediente { width: clamp(var(--alvo), 17cqmin, 150px); height: clamp(var(--alvo), 17cqmin, 150px); }
  .ingredientes { gap: 16px; }
  .tigela { width: min(38cqw, 64cqh, 470px); }
  .galinha-cozinha { height: min(100%, 58cqh); }
  .fogao { width: clamp(120px, 22cqmin, 220px); }
  .cozinha-fogao { height: 90%; }
}

/* Dançarinos do Cante: o balanço gira em torno dos pés; a folga embaixo impede que o canto passe do rodapé
   (fica neste arquivo porque ele carrega depois do estilo.css e sua regra .palco { bottom: 0 } anularia a de lá) */
.palco { bottom: max(24px, 6cqh); }
