/* Palco 720x1280, pensado para o celular em pé. */
* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #f4b7d4;
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
  color: #5c3b45;
}

#tela {
  width: 100%;
  height: 100dvh;
  height: 100vh;
  overflow: hidden;
  position: relative;
  padding:
    env(safe-area-inset-top)
    env(safe-area-inset-right)
    env(safe-area-inset-bottom)
    env(safe-area-inset-left);
  background:
    radial-gradient(circle at 50% 30%, #ffe4f2 0%, #f7c6de 46%, #e7a8c8 100%);
}

#carregando {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 5;
  font-size: 28px;
  font-weight: 800;
  color: #a24b6a;
  text-align: center;
  padding: 24px;
}

#carregando[hidden] { display: none; }

#palco {
  width: 720px;
  height: 1280px;
  position: absolute;
  left: 50%;
  top: 50%;
  overflow: hidden;
  visibility: hidden;
  background: #ffe8f2;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  transform-origin: center center;
}

#palco.pronto { visibility: visible; }

#palco.ovo .so-jogo { display: none !important; }

button, input { font-family: inherit; }

input {
  user-select: text;
  -webkit-user-select: text;
  touch-action: auto;
}

img { -webkit-user-drag: none; }

[hidden] { display: none !important; }

/* Cenários deslizam; o fundo anda um pouco mais que o bichinho. */
#cenas {
  position: absolute;
  left: 0;
  top: 0;
  height: 1280px;
  width: 3600px;
  display: flex;
  z-index: 1;
  transition: transform 0.5s cubic-bezier(.22, .8, .3, 1);
}

.cena {
  width: 720px;
  height: 1280px;
  flex: none;
  position: relative;
  overflow: hidden;
}

.cena-deriva {
  position: absolute;
  inset: -3%;
  animation: deriva 18s ease-in-out infinite;
}

.cena-fundo {
  position: absolute;
  inset: -2%;
  background-position: center;
  background-size: cover;
  transform: translate3d(calc(var(--px, 0) * 16px), calc(var(--py, 0) * 12px), 0);
}


@keyframes deriva {
  0%, 100% { transform: translate3d(-12px, 0, 0); }
  50% { transform: translate3d(12px, -10px, 0); }
}

#escurecer {
  position: absolute;
  inset: 0;
  background: rgba(18, 8, 40, 0.48);
  z-index: 2;
  pointer-events: none;
}

#brinquedos { position: absolute; inset: 0; z-index: 3; pointer-events: none; }

.brinquedo {
  position: absolute;
  width: 110px;
  height: 110px;
  object-fit: contain;
  pointer-events: auto;
  touch-action: none;
  filter: drop-shadow(0 8px 0 rgba(80, 40, 40, 0.15));
}

#pote {
  position: absolute;
  width: 110px;
  height: 110px;
  object-fit: contain;
  z-index: 14;
  pointer-events: none;
  filter: drop-shadow(0 6px 0 rgba(80, 40, 40, 0.12));
}

#eevee {
  position: absolute;
  z-index: 4;
  left: 200px;
  top: 700px;
  width: 320px;
  height: 320px;
  transition: left 0.5s cubic-bezier(.22, .8, .3, 1), top 0.5s cubic-bezier(.22, .8, .3, 1), width 0.5s, height 0.5s;
}

#sombra {
  position: absolute;
  left: 50%;
  bottom: 7%;
  width: 46%;
  height: 11%;
  background: radial-gradient(ellipse, rgba(70, 40, 30, 0.38), rgba(70, 40, 30, 0) 70%);
  pointer-events: none;
  transform-origin: center center;
}

#miolo {
  position: absolute;
  inset: 0;
  transform-origin: 50% 90%;
}

#sprite {
  width: 100%;
  height: 100%;
  display: block;
}

#acessorio {
  position: absolute;
  height: auto;
  pointer-events: none;
  filter: drop-shadow(0 3px 0 rgba(80, 40, 50, 0.12));
}

#balao {
  position: absolute;
  left: 58%;
  top: 4%;
  width: 230px;
  height: 150px;
  transform: translate(-20%, -92%);
  background: url("itens/efeitos/balao_fala.png") center / contain no-repeat;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 5;
  pointer-events: none;
}

#balao-texto {
  margin: 0;
  width: 78%;
  margin-top: -16px;
  text-align: center;
  font-size: 20px;
  font-weight: 800;
  line-height: 1.15;
  color: #6b3a4a;
}

#zzz {
  position: absolute;
  left: 70%;
  top: -18%;
  font-size: 44px;
  font-weight: 800;
  color: #f7f4ff;
  text-shadow: 0 4px 0 #6d5ca8;
  animation: zzz 1.6s ease-in-out infinite;
  pointer-events: none;
}

@keyframes zzz {
  0%, 100% { transform: translateY(0); opacity: 0.75; }
  50% { transform: translateY(-14px); opacity: 1; }
}

#sabonete {
  position: absolute;
  left: 48px;
  top: 790px;
  width: 130px;
  height: 130px;
  padding: 0;
  border: 0;
  background: transparent;
  z-index: 8;
  touch-action: none;
  transition: left 0.25s ease, top 0.25s ease;
  filter: drop-shadow(0 8px 0 rgba(40, 60, 80, 0.18));
}

#sabonete img { width: 100%; height: 100%; object-fit: contain; }

#sabonete.arrastando { transition: none; filter: drop-shadow(0 14px 0 rgba(40, 60, 80, 0.2)); }

#luz {
  position: absolute;
  right: 28px;
  top: 250px;
  width: 132px;
  height: 132px;
  border: 0;
  padding: 8px 8px 18px;
  z-index: 9;
  color: #6b3a4a;
  font-weight: 800;
  font-size: 18px;
  background: url("itens/efeitos/botao_menta.png") center / 100% 100% no-repeat;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

#luz img { width: 64px; height: 64px; }

#frutas {
  position: absolute;
  inset: 0;
  z-index: 8;
  pointer-events: none;
}

.fruta {
  position: absolute;
  left: 0;
  top: 0;
  width: 112px;
  height: 112px;
  pointer-events: auto;
  touch-action: none;
  filter: drop-shadow(0 6px 0 rgba(40, 70, 30, 0.15));
}

#efeitos {
  position: absolute;
  inset: 0;
  z-index: 7;
  pointer-events: none;
  overflow: hidden;
}

.efeito-sobe, .confete, .estrela-nivel {
  position: absolute;
  pointer-events: none;
}

.efeito-sobe {
  width: 84px;
  height: 84px;
  object-fit: contain;
  animation: sobe 1.5s ease-out forwards;
}

@keyframes sobe {
  from { transform: translateY(0) scale(0.7); opacity: 1; }
  to { transform: translateY(-170px) scale(1.05); opacity: 0; }
}

.confete {
  width: 70px;
  height: 70px;
  object-fit: contain;
  animation: cai 1.5s ease-in forwards;
}

@keyframes cai {
  from { transform: translate(0, 0) rotate(0deg); opacity: 1; }
  to { transform: translate(var(--dx), 520px) rotate(220deg); opacity: 0.2; }
}

.estrela-nivel {
  width: 180px;
  height: 180px;
  object-fit: contain;
  animation: estrela 1.3s ease-out forwards;
}

@keyframes estrela {
  0% { transform: translate(-50%, -40%) scale(0.4); opacity: 0; }
  30% { opacity: 1; }
  100% { transform: translate(-50%, -120%) scale(1.3); opacity: 0; }
}

#fantasma {
  position: absolute;
  width: 130px;
  height: 130px;
  margin-left: -65px;
  margin-top: -75px;
  z-index: 14;
  pointer-events: none;
  filter: drop-shadow(0 12px 0 rgba(80, 40, 40, 0.18));
}

#hud {
  position: absolute;
  top: 12px;
  left: 12px;
  right: 12px;
  z-index: 10;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.hud-topo {
  display: flex;
  align-items: center;
  gap: 8px;
}

#nome-pet {
  font-size: 32px;
  font-weight: 800;
  color: #a24b6a;
  text-shadow: 0 2px 0 #fff, 0 0 8px #fff;
  max-width: 210px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#nivel-caixa, #moedas-caixa {
  display: flex;
  align-items: center;
  gap: 2px;
  font-weight: 800;
  font-size: 22px;
  color: #6b3a4a;
  text-shadow: 0 2px 0 #fff;
}

#nivel-caixa img, #moedas-caixa img { width: 36px; height: 36px; }

#xp {
  width: 46px;
  height: 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.75);
  overflow: hidden;
  border: 2px solid #e0b08a;
}

#xp-fill {
  height: 100%;
  width: 0;
  background: #ffb347;
}

.hud-botoes {
  margin-left: auto;
  display: flex;
  gap: 2px;
}

.icone-btn {
  width: 58px;
  height: 58px;
  border: 0;
  padding: 0;
  background: url("itens/efeitos/botao_rosa2.png") center / 100% 100% no-repeat;
  display: grid;
  place-items: center;
}

.icone-btn img { width: 34px; height: 34px; pointer-events: none; }

.icone-btn.pulso { animation: pulso 1.15s ease-in-out infinite; }

@keyframes pulso {
  50% { transform: scale(1.1); }
}

.balanca { animation: balanca 0.45s ease; }

@keyframes balanca {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

#barras {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 12px;
}

.stat { display: flex; align-items: center; gap: 4px; }

.stat-ico { width: 36px; height: 36px; }

.stat-track {
  position: relative;
  flex: 1;
  height: 34px;
  border-radius: 999px;
  overflow: hidden;
  background: #fffdf8;
}

.stat-fill {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 0;
  transition: width 0.35s ease;
}

.fill-fome { background: #ff9f43; }
.fill-felicidade { background: #ff6fa5; }
.fill-energia { background: #6ec6ff; }
.fill-higiene { background: #5ad6bf; }

.stat-moldura {
  position: absolute;
  inset: 0;
  background: url("itens/efeitos/barra_moldura.png") center / 108% 305% no-repeat;
  mix-blend-mode: multiply;
  pointer-events: none;
}

.stat-num {
  position: absolute;
  right: 12px;
  top: 0;
  bottom: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  font-size: 16px;
  font-weight: 800;
  color: #6a4030;
}

#hud-jogo {
  position: absolute;
  top: 168px;
  left: 0;
  right: 0;
  z-index: 11;
  display: flex;
  justify-content: center;
  gap: 16px;
  pointer-events: none;
}

#tempo-jogo, #placar-jogo {
  background: rgba(255, 250, 245, 0.92);
  color: #a24b6a;
  font-weight: 800;
  font-size: 28px;
  border-radius: 999px;
  padding: 6px 18px;
}

#gaveta {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 142px;
  z-index: 13;
  display: flex;
  align-items: center;
  gap: 4px;
  background: rgba(255, 250, 245, 0.94);
  border-radius: 28px;
  padding: 8px;
  box-shadow: 0 8px 0 rgba(120, 60, 80, 0.1);
}

#gaveta-miolo { flex: 1; min-width: 0; }

#gaveta-dica {
  margin: 0 8px 4px;
  text-align: center;
  font-size: 18px;
  font-weight: 800;
  color: #a24b6a;
}

#gaveta-lista {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  touch-action: pan-x;
  padding: 2px 4px 6px;
}

#gaveta-esq, #gaveta-dir {
  width: 42px;
  height: 72px;
  border: 0;
  border-radius: 16px;
  background: #ffd0e2;
  color: #a24b6a;
  font-size: 32px;
  font-weight: 800;
  flex: none;
}

.comida {
  flex: none;
  width: 108px;
  text-align: center;
  touch-action: none;
  background: transparent;
  border: 0;
  padding: 0;
  color: #6b3a4a;
}

.comida img {
  width: 78px;
  height: 78px;
  object-fit: contain;
  pointer-events: none;
}

.comida span {
  display: block;
  font-size: 15px;
  font-weight: 800;
}

.comida.sem-moeda { opacity: 0.45; }

#rodape-info {
  position: absolute;
  left: 24px;
  right: 24px;
  bottom: 146px;
  z-index: 11;
  text-align: center;
  pointer-events: none;
}

#palco.cozinha #rodape-info,
#palco.jogando #rodape-info { visibility: hidden; }

#dica {
  display: inline-block;
  margin: 6px 0 0;
  background: rgba(255, 250, 245, 0.9);
  border-radius: 999px;
  padding: 8px 16px;
  font-size: 22px;
  font-weight: 800;
  color: #6b3a4a;
}

#pips {
  display: flex;
  justify-content: center;
  gap: 6px;
}

#pips span {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.7);
  box-shadow: inset 0 0 0 2px #e39ab6;
}

#pips span.feito { background: #ff7eae; }

#nav {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 136px;
  z-index: 12;
  display: flex;
  justify-content: space-around;
  align-items: center;
  padding: 0 6px 8px;
  background: linear-gradient(180deg, rgba(255, 246, 250, 0), rgba(255, 236, 244, 0.96) 32%);
}

#nav.travada { filter: grayscale(0.35); }

.nav-btn {
  width: 108px;
  height: 108px;
  border: 0;
  padding: 0;
  background: url("itens/efeitos/botao_rosa.png") center / 100% 100% no-repeat;
  display: grid;
  place-items: center;
}

.nav-btn img { width: 62px; height: 62px; pointer-events: none; }

.nav-btn.ativo {
  background-image: url("itens/efeitos/botao_menta.png");
  transform: translateY(-8px);
}

#toast {
  position: absolute;
  left: 50%;
  top: 42%;
  transform: translate(-50%, -50%);
  z-index: 30;
  background: #fff;
  color: #6b3a4a;
  font-weight: 800;
  font-size: 26px;
  padding: 16px 22px;
  border-radius: 22px;
  box-shadow: 0 8px 0 rgba(120, 50, 70, 0.15);
  text-align: center;
}

.modal {
  position: absolute;
  inset: 0;
  z-index: 20;
  background: rgba(80, 30, 50, 0.38);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.cartao {
  width: min(560px, 100%);
  background: #fffaf6;
  border-radius: 32px;
  padding: 28px 22px 22px;
  box-shadow: 0 14px 0 rgba(120, 50, 70, 0.14);
  text-align: center;
  position: relative;
  max-height: 92%;
  overflow: auto;
  touch-action: pan-y;
}

.cartao h2 {
  margin: 0 0 8px;
  font-size: 36px;
  color: #a24b6a;
}

.cartao p {
  margin: 0 0 16px;
  font-size: 22px;
  line-height: 1.3;
}

.cartao button, .aba {
  border: 0;
  cursor: pointer;
}

.cartao > button, #form-nome button, .abas button {
  width: 100%;
  min-height: 74px;
  margin-top: 10px;
  border: 0;
  border-radius: 18px;
  font-size: 26px;
  font-weight: 800;
  color: #5c3b45;
  background: url("itens/efeitos/botao_menta.png") center / 100% 100% no-repeat;
}

.cartao .perigo {
  background-image: url("itens/efeitos/botao_rosa.png");
  color: #6b3048;
}

.fechar {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 54px !important;
  min-height: 54px !important;
  margin: 0 !important;
  border-radius: 50% !important;
  font-size: 22px !important;
  background: #ffd0e2 !important;
}

#campo-nome {
  width: 100%;
  height: 72px;
  border-radius: 18px;
  border: 4px solid #f0b7cb;
  font-size: 32px;
  font-weight: 800;
  text-align: center;
  color: #6b3a4a;
}

.abas { display: flex; gap: 8px; }

.abas button { flex: 1; min-height: 58px; font-size: 22px; opacity: 0.7; }

.abas button.ativa { opacity: 1; }

#loja-lista {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 12px;
  max-height: 620px;
  overflow: auto;
  touch-action: pan-y;
}

.item-loja {
  background: #fff;
  border-radius: 20px;
  padding: 8px;
  box-shadow: 0 4px 0 #f0d0dc;
}

.item-loja img {
  width: 88px;
  height: 88px;
  object-fit: contain;
  display: block;
  margin: 0 auto;
}

.item-loja strong, .item-loja em {
  display: block;
  font-style: normal;
  font-size: 16px;
}

.item-loja button {
  width: 100%;
  min-height: 46px;
  margin-top: 4px;
  border: 0;
  border-radius: 12px;
  background: #ffe1ec;
  color: #6b3a4a;
  font-weight: 800;
  font-size: 16px;
}

.item-loja button:disabled { opacity: 0.55; }

#presente-img {
  width: 160px;
  height: 160px;
  object-fit: contain;
}

@media (hover: hover) {
  .nav-btn:hover, .icone-btn:hover, .comida:hover { filter: brightness(1.05); }
}

@media (prefers-reduced-motion: reduce) {
  .cena-deriva, #zzz, .icone-btn.pulso { animation: none; }
  #cenas, #eevee, .stat-fill { transition: none; }
}
