/* ============================================================
   PIPO · base visual
   Cores, tipografia, botões, mascote, cenários e animações.
   ============================================================ */
:root {
  --roxo: #7B61FF;   --roxo-escuro: #5F3DC4;
  --rosa: #FF7EB6;   --rosa-escuro: #E0559A;
  --amarelo: #FFC93C; --amarelo-escuro: #E6A700;
  --verde: #2FCB7A;  --verde-escuro: #1FA462;
  --azul: #4DB5FF;   --azul-escuro: #1C8FE0;
  --laranja: #FF9F43;
  --vermelho: #FF6B6B;
  --tinta: #3A2E5C;
  --tinta-suave: #7A6F99;
  --papel: #FFFFFF;
  --creme: #FFF9F0;
  --linha: #EEE8FB;
  --sombra-cartao: 0 10px 30px rgba(58, 46, 92, .13);
  --raio: 24px;
  --fonte: 'Fredoka', 'Baloo 2', 'Nunito', 'Segoe UI Rounded', 'Segoe UI', system-ui, sans-serif;
  --emoji: 'Segoe UI Emoji', 'Apple Color Emoji', 'Noto Color Emoji', sans-serif;
  --app-h: 100dvh; /* altura útil do jogo (no 16:9 vira a altura do palco) */
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--fonte);
  color: var(--tinta);
  background: radial-gradient(circle at 20% 15%, #E9F8FF, #BFE6FF 70%);
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
  touch-action: manipulation;
  overscroll-behavior: none;
}
button { font-family: inherit; color: inherit; border: 0; background: none; padding: 0; cursor: pointer; }
button:focus-visible { outline: 4px solid var(--azul); outline-offset: 3px; }
.escondido { display: none !important; }

/* ---------- moldura do app (pensado para celular) ---------- */
#app {
  position: relative;
  max-width: 560px;
  height: 100vh;
  height: 100dvh;
  margin: 0 auto;
  overflow: hidden;
  background: var(--creme);
}
@media (min-width: 600px) {
  #app { box-shadow: 0 0 0 1px rgba(58, 46, 92, .06), 0 20px 70px rgba(58, 46, 92, .18); }
}

.tela {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
  transition: opacity .3s ease, transform .3s ease;
}
.tela-entrando { opacity: 0; transform: scale(.97); }
.tela-saindo { opacity: 0; pointer-events: none; z-index: 0; }

#particulas { position: fixed; inset: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 50; }
#camada-flutuante { position: fixed; inset: 0; pointer-events: none; z-index: 45; }
#camada-toast {
  position: fixed; top: 14px; left: 50%; transform: translateX(-50%);
  z-index: 60; display: flex; flex-direction: column; gap: 8px;
  width: min(92vw, 400px); pointer-events: none;
}

/* ---------- botões ---------- */
.btn {
  --c: var(--roxo); --c2: var(--roxo-escuro);
  font: 600 22px/1 var(--fonte);
  color: #fff;
  background: var(--c);
  border-radius: 999px;
  padding: 16px 28px;
  box-shadow: 0 6px 0 var(--c2), 0 12px 22px rgba(58, 46, 92, .16);
  transition: transform .1s ease, box-shadow .1s ease;
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  text-shadow: 0 2px 0 rgba(0, 0, 0, .12);
}
.btn:active { transform: translateY(4px); box-shadow: 0 2px 0 var(--c2), 0 5px 10px rgba(58, 46, 92, .12); }
.btn-principal { --c: var(--verde); --c2: var(--verde-escuro); }
.btn-secundario { --c: #fff; --c2: #E3DDF5; color: var(--tinta); text-shadow: none; }
.btn.desabilitado { --c: #CFC8E3; --c2: #B4ABCF; }

.btn-icone, .btn-redondo {
  width: 52px; height: 52px; flex: none;
  border-radius: 18px;
  background: #fff;
  color: var(--tinta);
  box-shadow: 0 4px 0 #E3DDF5, 0 8px 16px rgba(58, 46, 92, .08);
  display: grid; place-items: center;
  transition: transform .1s;
}
.btn-redondo { width: 60px; height: 60px; border-radius: 50%; }
.btn-icone:active, .btn-redondo:active { transform: translateY(3px); box-shadow: 0 1px 0 #E3DDF5; }
.btn-icone svg, .btn-redondo svg { width: 26px; height: 26px; }

.pilulas { display: flex; gap: 8px; }
.pilula {
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(255, 255, 255, .95);
  border-radius: 999px;
  padding: 6px 14px 6px 8px;
  font-weight: 700; font-size: 18px;
  box-shadow: 0 3px 0 rgba(58, 46, 92, .08);
}
.pilula i { font-style: normal; font-size: 20px; }
.moeda-ico {
  display: inline-block; width: 1em; height: 1em; flex: none;
  border-radius: 50%; vertical-align: -.14em; font-style: normal;
  background:
    radial-gradient(circle at 34% 30%, #FFF6D0 0 12%, transparent 13%),
    radial-gradient(circle, #FFD43B 0 50%, #F0A000 51% 58%, #FFC93C 59%);
  box-shadow: inset 0 -.08em 0 rgba(180, 110, 0, .35), 0 .04em 0 rgba(0, 0, 0, .12);
}

/* ---------- barra do topo ---------- */
.topo {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 12px 16px 8px;
  position: relative; z-index: 3;
}
.topo-titulo { font-size: 24px; font-weight: 700; flex: 1; text-align: center; }

/* ---------- mascote ---------- */
.mascote-caixa { position: relative; display: inline-block; }
.balao {
  position: absolute;
  left: 78%; bottom: 72%;
  background: #fff;
  color: var(--tinta);
  font-weight: 600; font-size: 17px; line-height: 1.2;
  padding: 10px 14px;
  border-radius: 18px 18px 18px 4px;
  box-shadow: var(--sombra-cartao);
  white-space: nowrap;
  z-index: 5;
  pointer-events: none;
}
.balao-entrar { animation: balao-entrar .35s cubic-bezier(.3, 1.6, .5, 1); }

/* ---------- cenários (tela inicial e perfil) ---------- */
[data-cenario] { --ceu1: #8FD8FF; --ceu2: #D9F3FF; --colina1: #9BE36B; --colina2: #6FD06B; --nuvem: #fff; }
[data-cenario="cenario-por-do-sol"] { --ceu1: #FF9A8B; --ceu2: #FFE29F; --colina1: #F7A072; --colina2: #E8845C; --nuvem: #FFF1E6; }
[data-cenario="cenario-noite"] { --ceu1: #1E1B4B; --ceu2: #4C3F91; --colina1: #3B3486; --colina2: #2A2466; --nuvem: #8B84C9; }
[data-cenario="cenario-arco-iris"] { --ceu1: #C7B8FF; --ceu2: #FFE3F1; --colina1: #B8F0C9; --colina2: #8DE3A8; --nuvem: #fff; }
[data-cenario="cenario-doces"] { --ceu1: #FFB5D8; --ceu2: #FFF0F7; --colina1: #FFD6E8; --colina2: #FFB0CF; --nuvem: #fff; }
[data-cenario="cenario-floresta"] { --ceu1: #7BD8B5; --ceu2: #E3FFF1; --colina1: #3FBF7F; --colina2: #2A9D68; --nuvem: #F0FFF8; }

.cenario-fundo {
  position: absolute; inset: 0; overflow: hidden; z-index: 0;
  background: linear-gradient(180deg, var(--ceu1), var(--ceu2) 65%);
}
[data-cenario="cenario-arco-iris"] .cenario-fundo::before {
  content: ''; position: absolute; left: 50%; top: 38%; width: 150%; aspect-ratio: 1; transform: translateX(-50%);
  border-radius: 50%; opacity: .5;
  background: radial-gradient(circle, transparent 52%, #FF8FA3 52% 55%, #FFC06B 55% 58%, #FFE66B 58% 61%, #8BE39B 61% 64%, #7CC4FF 64% 67%, #B39BFF 67% 70%, transparent 70%);
}
[data-cenario="cenario-noite"] .cenario-fundo::before {
  content: ''; position: absolute; inset: 0;
  background-image: radial-gradient(2px 2px at 20% 20%, #fff, transparent), radial-gradient(2px 2px at 70% 12%, #fff, transparent),
    radial-gradient(1.5px 1.5px at 40% 35%, #fff, transparent), radial-gradient(2px 2px at 85% 40%, #fff, transparent),
    radial-gradient(1.5px 1.5px at 10% 50%, #fff, transparent), radial-gradient(2px 2px at 55% 8%, #fff, transparent);
}
.nuvem {
  position: absolute; width: 120px; height: 40px; border-radius: 40px; background: var(--nuvem); opacity: .9;
  animation: nuvem 40s linear infinite;
}
.nuvem::before, .nuvem::after { content: ''; position: absolute; background: inherit; border-radius: 50%; }
.nuvem::before { width: 56px; height: 56px; left: 16px; top: -26px; }
.nuvem::after { width: 44px; height: 44px; left: 58px; top: -18px; }
.nuvem.n1 { top: 12%; left: -10%; animation-duration: 46s; }
.nuvem.n2 { top: 26%; left: 40%; transform: scale(.7); animation-duration: 60s; animation-delay: -20s; }
.nuvem.n3 { top: 6%; left: 70%; transform: scale(.55); animation-duration: 52s; animation-delay: -35s; }
.colina { position: absolute; border-radius: 50%; }
.colina.c1 { width: 140%; height: 42%; left: -45%; bottom: -18%; background: var(--colina1); }
.colina.c2 { width: 130%; height: 38%; right: -50%; bottom: -20%; background: var(--colina2); }

/* ---------- elementos flutuantes ---------- */
.fantasma-arraste {
  position: fixed; left: 0; top: 0; margin: 0 !important;
  pointer-events: none; z-index: 46;
  filter: drop-shadow(0 12px 16px rgba(58, 46, 92, .3));
  transition: none;
}
.arrastando-origem { opacity: .25; }
.moeda-voando, .emoji-voando {
  position: fixed; left: 0; top: 0; font-size: 30px; line-height: 1;
  margin: -15px 0 0 -15px; font-family: var(--emoji);
  filter: drop-shadow(0 4px 4px rgba(0, 0, 0, .15));
}
.emoji-voando { font-size: 40px; margin: -20px 0 0 -20px; }

.toast {
  display: flex; align-items: center; gap: 12px;
  background: #fff; border-radius: 20px; padding: 12px 16px;
  box-shadow: 0 14px 36px rgba(58, 46, 92, .22);
  animation: toast-entrar .45s cubic-bezier(.3, 1.5, .5, 1);
}
.toast.saindo { animation: toast-sair .4s ease forwards; }
.toast-icone { font-size: 32px; }
.toast b { display: block; font-size: 17px; }
.toast small { display: block; color: var(--tinta-suave); font-size: 15px; }

.estrela-svg { width: 100%; height: 100%; display: block; overflow: visible; }
.estrela-svg path:first-child { stroke-width: 3; }
.estrela-svg.cheia path:first-child { fill: #FFC93C; stroke: #F5A300; }
.estrela-svg.vazia path:first-child { fill: #EDE8F8; stroke: #DCD4F0; }
.estrela-svg .estrela-brilho { stroke: #FFF3BF; stroke-width: 4; stroke-linecap: round; fill: none; }
.estrela-svg.vazia .estrela-brilho { display: none; }

/* ---------- animações utilitárias ---------- */
.pular { animation: pular .45s cubic-bezier(.3, 1.6, .5, 1); }
.tremer { animation: tremer .45s ease; }
.balancar { animation: balancar .5s ease; }
.entrar-pulo { animation: entrar-pulo .45s cubic-bezier(.3, 1.5, .5, 1); }

@keyframes pular { 0% { transform: scale(1); } 40% { transform: scale(1.25); } 100% { transform: scale(1); } }
@keyframes tremer { 20% { transform: translateX(-8px); } 40% { transform: translateX(8px); } 60% { transform: translateX(-5px); } 80% { transform: translateX(5px); } }
@keyframes balancar { 25% { transform: rotate(-12deg); } 50% { transform: rotate(10deg); } 75% { transform: rotate(-6deg); } }
@keyframes entrar-pulo { 0% { transform: scale(.85); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }
@keyframes flutuar { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
@keyframes respirar { 0%, 100% { transform: scale(1, 1); } 50% { transform: scale(1.02, .98); } }
@keyframes quicar { 0%, 100% { transform: translateY(0) scale(1, 1); } 30% { transform: translateY(0) scale(1.06, .94); } 60% { transform: translateY(-16px) scale(.97, 1.03); } }
@keyframes acenar-e { 0%, 100% { transform: rotate(140deg); } 50% { transform: rotate(160deg); } }
@keyframes acenar-d { 0%, 100% { transform: rotate(-140deg); } 50% { transform: rotate(-160deg); } }
@keyframes palma-e { 0%, 100% { transform: rotate(115deg); } 50% { transform: rotate(165deg); } }
@keyframes palma-d { 0%, 100% { transform: rotate(-115deg); } 50% { transform: rotate(-165deg); } }
@keyframes susto { 0% { transform: translateY(0); } 40% { transform: translateY(-14px) scale(1.04); } 100% { transform: translateY(0); } }
@keyframes inclinar { 0%, 100% { transform: rotate(-4deg); } 50% { transform: rotate(3deg); } }
@keyframes orelha { 0%, 90%, 100% { transform: rotate(0); } 94% { transform: rotate(-10deg); } }
@keyframes piscar { 0%, 92%, 100% { transform: scaleY(1); } 95% { transform: scaleY(.1); } }
@keyframes pet { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }
@keyframes balao-entrar { 0% { transform: scale(.4) translateY(10px); opacity: 0; transform-origin: 0 100%; } 100% { transform: scale(1); opacity: 1; } }
@keyframes nuvem { from { translate: 0 0; } to { translate: 160vw 0; } }
@keyframes toast-entrar { 0% { transform: translateY(-30px) scale(.9); opacity: 0; } 100% { transform: none; opacity: 1; } }
@keyframes toast-sair { to { transform: translateY(-20px); opacity: 0; } }
@keyframes pulso { 0% { box-shadow: 0 0 0 0 rgba(255, 201, 60, .7); } 100% { box-shadow: 0 0 0 22px rgba(255, 201, 60, 0); } }
@keyframes girar { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
