/* Inter (SIL Open Font License), servida pelo próprio site. Licença em /fonts/OFL.txt. */
@font-face {
  font-family: "Inter";
  src: url("/fonts/inter-latin.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329,
    U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* Pixelify Sans (SIL Open Font License), fonte pixel art do balão do boneco. Licença em /fonts/OFL-pixelify-sans.txt. */
@font-face {
  font-family: "Pixelify Sans";
  src: url("/fonts/pixelify-sans-latin.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329,
    U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --fundo: #0a0b0d;
  --tinta: #f5f6f8;
  --suave: #8c8c8c;
  --azul: #3b82f6;
  --azul-botao: #2563eb;
  --brilho: rgba(59, 130, 246, 0.45);
  color-scheme: dark;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

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

body {
  position: relative; /* referência da .trilha do boneco */
  margin: 0;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(50% 38% at 50% 32%, rgba(59, 130, 246, 0.12), transparent 70%),
    var(--fundo);
  color: var(--tinta);
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

main {
  flex: 1;
  width: 100%;
  max-width: 440px;
  margin: 0 auto;
  padding: 40px 16px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

/* Moeda 3D (moeda.js). Aparece quando o primeiro quadro fica pronto. */
.palco {
  position: relative;
  width: min(240px, 62vw);
  height: min(240px, 62vw);
  margin-bottom: 20px;
}

.palco::before {
  content: "";
  position: absolute;
  inset: 12%;
  border-radius: 50%;
  background: radial-gradient(circle, var(--brilho), transparent 70%);
  filter: blur(28px);
  opacity: 0;
  transition: opacity 1s ease;
}

.moeda {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  opacity: 0;
  transform: scale(0.9);
  transition: opacity 0.7s ease, transform 0.9s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.palco.pronta::before {
  opacity: 0.55;
}

.palco.pronta .moeda {
  opacity: 1;
  transform: none;
}

/* boneco.js: a moeda encolhe e voa até a mão do boneco (--dx, --dy, --s calculados no JS). */
.palco.vazia::before {
  opacity: 0;
}

.palco.pronta .moeda.pega {
  opacity: 0;
  transform: translate(var(--dx), var(--dy)) scale(var(--s));
  transition:
    transform 0.5s cubic-bezier(0.5, 0, 0.8, 0.4),
    opacity 0.12s 0.42s linear;
}

/* Volta da moeda depois que o boneco sai: parte pequena e invisível, sem animar a ida. */
.palco.pronta .moeda.voltando {
  opacity: 0;
  transform: scale(0.85);
  transition: none;
}

/* Faixa onde o boneco anda, recortada e com as pontas esmaecidas. */
.trilha {
  position: absolute;
  left: 0;
  right: 0;
  width: min(100%, 960px);
  margin: 0 auto;
  overflow: hidden;
  pointer-events: none;
  z-index: 2;
  -webkit-mask-image: linear-gradient(to right, transparent, #000 40px, #000 calc(100% - 40px), transparent);
  mask-image: linear-gradient(to right, transparent, #000 40px, #000 calc(100% - 40px), transparent);
}

/* Abertura: o boneco corre pela tela toda atrás do cursor. */
.perseguicao {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 10;
}

/* Enquanto o boneco arrasta a cópia, o cursor real fica escondido. */
html.sem-cursor,
html.sem-cursor * {
  cursor: none !important;
}

.cursor-falso {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 11;
  pointer-events: none;
  will-change: transform;
}

/* Balão de fala do boneco: pixel art, texto digitado letra a letra (boneco.js). */
.balao {
  --ponta: 50%;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 12;
  width: max-content;
  max-width: min(280px, calc(100vw - 16px));
  padding: 10px 14px 16px;
  background: #fffaf0;
  color: #1d1d27;
  border: 3px solid #1d1d27;
  box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.45);
  font-family: "Pixelify Sans", ui-monospace, monospace;
  font-size: 18px;
  line-height: 1.3;
  text-align: left;
  cursor: pointer;
  user-select: none;
}

/* Ponta do balão: triângulo escuro (contorno) com um claro por cima, colado na borda. */
.balao::before,
.balao::after {
  content: "";
  position: absolute;
  left: var(--ponta);
  transform: translateX(-50%);
  clip-path: polygon(0 0, 100% 0, 50% 100%);
}

.balao::before {
  top: 100%;
  width: 18px;
  height: 12px;
  background: #1d1d27;
}

.balao::after {
  top: calc(100% - 3px);
  width: 10px;
  height: 7px;
  background: #fffaf0;
}

.balao-texto {
  margin: 0;
}

.balao .letra {
  visibility: hidden;
}

.balao .letra.vista {
  visibility: visible;
}

.balao a {
  color: var(--azul-botao);
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* Setinha piscando no canto quando terminou de digitar (clique para fechar). */
.balao-mais {
  position: absolute;
  right: 6px;
  bottom: 4px;
  width: 9px;
  height: 6px;
  background: #1d1d27;
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  opacity: 0;
}

.balao.pronto .balao-mais {
  animation: piscar 1s linear infinite;
}

@keyframes piscar {
  0%,
  49% {
    opacity: 1;
  }
  50%,
  100% {
    opacity: 0;
  }
}

.so-leitor {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.boneco {
  position: absolute;
  top: 0;
  left: 0;
  display: block;
  image-rendering: pixelated;
  will-change: transform;
}

h1 {
  margin: 0;
  font-size: clamp(2.75rem, 12vw, 3.75rem);
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1;
}

.pedido,
.valor {
  display: block;
}

.pedido {
  color: var(--tinta);
}

.valor {
  color: var(--azul);
  text-shadow: 0 0 28px var(--brilho);
}

/* Mesma tipografia do subtítulo da referência: Inter 400, 20/28, cinza. */
.sub {
  max-width: 384px;
  margin: 20px 0 32px;
  font-size: 1.25rem;
  font-weight: 400;
  line-height: 1.75rem;
  color: var(--suave);
}

.agradecimento {
  color: var(--tinta);
}

.pagar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 320px;
  min-height: 56px;
  padding: 0 28px;
  border-radius: 14px;
  background: var(--azul-botao);
  color: #ffffff;
  font-size: 1.125rem;
  font-weight: 700;
  text-decoration: none;
  box-shadow: 0 10px 32px -14px var(--brilho);
  transition: transform 0.15s ease, background-color 0.2s ease, box-shadow 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}

.pagar:hover,
.pagar.puxado {
  background: var(--azul);
  box-shadow: 0 14px 40px -12px var(--brilho);
}

.pagar:active {
  transform: scale(0.98);
}

/* Espaço reservado desde o início: o número chega depois sem empurrar a página. */
.contador {
  min-height: 1.5em;
  margin: 20px 0 0;
  font-size: 0.9375rem;
  color: var(--suave);
  visibility: hidden;
  opacity: 0;
  transition: opacity 0.5s ease;
}

.contador.pronto {
  visibility: visible;
  opacity: 1;
}

.contador strong {
  color: var(--tinta);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

footer {
  padding: 16px 16px 28px;
  text-align: center;
}

.rodape {
  margin: 0 0 4px;
  font-size: 0.875rem;
  color: var(--suave);
}

.link {
  border: 0;
  background: none;
  padding: 8px;
  color: var(--suave);
  font: inherit;
  font-size: 0.875rem;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

button:focus-visible,
a:focus-visible {
  outline: 2px solid var(--azul);
  outline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {
  .moeda,
  .palco::before,
  .pagar,
  .contador {
    transition: none;
  }
}
