:root {
  --fundo: #FFFBF3;
  --tinta: #8a847e;      /* cinza no lugar do preto */
  --suave: #a8a29b;
  --linha: rgba(27, 26, 25, .14);
  --papel: #fffefc;
  --rosa: #F48591;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }

html, body {
  height: 100%;
  min-height: 100dvh;
  overflow: hidden;
  overscroll-behavior: none;
  background: var(--fundo);
}

body {
  font-family: 'Londrina Solid', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: var(--tinta);
  font-weight: 400;
}

#palco {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100dvh;
  display: block;
  touch-action: none;
  cursor: grab;
}
#palco.pegando { cursor: grabbing; }

/* ---------- a carta: grande, no meio da tela, formato de carta ---------- */
.carta {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(92vw, 660px, 60dvh);
  aspect-ratio: 17 / 24;
  background: var(--papel);
  border: 1px solid var(--linha);
  border-radius: 34px;
  padding: clamp(24px, 4.5vw, 46px);
  box-shadow: 0 34px 80px -22px rgba(27, 26, 25, .34), 0 3px 10px rgba(27, 26, 25, .07);
  display: flex;
  flex-direction: column;
  justify-content: center;
  animation: entra .48s cubic-bezier(.2, .9, .2, 1) both;
}
@keyframes entra {
  from { opacity: 0; transform: translate(-50%, -46%) scale(.9) rotate(-1.5deg); }
  to   { opacity: 1; transform: translate(-50%, -50%) scale(1) rotate(0); }
}

.ico {
  position: absolute;
  top: 14px;
  right: 16px;
  border: 0;
  background: transparent;
  /* a Londrina não tem o × — esse botãozinho usa a fonte do sistema */
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  font-size: 30px;
  line-height: 1;
  color: var(--suave);
  cursor: pointer;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  transition: background .2s ease, color .2s ease, transform .25s ease;
}
.ico:hover { background: rgba(27, 26, 25, .06); color: var(--tinta); transform: rotate(90deg); }

#form {
  display: flex;
  flex-direction: column;
  gap: clamp(14px, 2.6vh, 22px);
}

/* uma linha só */
#campo {
  width: 100%;
  border: 2px solid var(--linha);
  border-radius: 999px;
  background: #fff;
  padding: clamp(16px, 3.2vh, 26px) 26px;
  font-family: inherit;
  font-size: clamp(22px, 6.4vw, 34px);
  letter-spacing: .09em;
  text-align: center;
  color: var(--tinta);
  outline: none;
  transition: border-color .2s ease, box-shadow .2s ease;
}
#campo::placeholder { color: #c9c2ba; letter-spacing: .09em; }
#campo:focus { border-color: var(--rosa); box-shadow: 0 0 0 6px rgba(244, 133, 145, .18); }

.linha {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

.btn {
  font-family: inherit;
  border-radius: 999px;
  border: 2px solid transparent;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform .18s cubic-bezier(.2,.8,.2,1), background .2s ease, color .2s ease, border-color .2s ease;
}
.btn:active { transform: scale(.96); }

.primario {
  background: var(--rosa);
  color: #fff;
  font-size: clamp(28px, 8vw, 40px);
  font-weight: 400;
  letter-spacing: .16em;
  padding: clamp(14px, 3vh, 24px) 26px;
  width: 100%;
}
.primario:hover { background: #ef7181; }

.fantasma {
  background: transparent;
  color: var(--suave);
  border-color: var(--linha);
  font-size: clamp(17px, 4.4vw, 21px);
  letter-spacing: .12em;
  padding: 10px 20px;
}
.fantasma:hover { color: var(--tinta); border-color: rgba(27, 26, 25, .34); }

/* ---------- o site, abrindo à direita ---------- */
.site-painel {
  position: fixed;
  top: 0;
  right: 0;
  height: 100dvh;
  width: min(46vw, 640px);
  background: var(--papel);
  box-shadow: -34px 0 80px -22px rgba(27, 26, 25, .34), -3px 0 10px rgba(27, 26, 25, .07);
  z-index: 5;
  transform: translateX(100%);
  transition: transform .42s cubic-bezier(.2, .9, .2, 1);
}
.site-painel.aberto { transform: translateX(0); }
.site-painel .ico {
  position: absolute;
  top: 14px;
  left: 16px;
  right: auto;
  background: var(--papel);
  box-shadow: 0 2px 10px rgba(27, 26, 25, .18);
  z-index: 1;
}
.site-frame {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

@media (max-width: 720px) {
  .site-painel { width: 100vw; }
}

/* ---------- o portal: a bolinha devorando a tela ---------- */
.portal {
  position: fixed;
  inset: 0;
  z-index: 40;
  clip-path: circle(0px at 50% 50%);
  transition: clip-path .62s cubic-bezier(.65, 0, .35, 1);
  pointer-events: none;
}

/* ---------- o mundo: canvas infinito com a cor da bolinha ---------- */
.mundo {
  position: fixed;
  inset: 0;
  z-index: 30;
  overflow: hidden;
  cursor: grab;
  touch-action: none;
}
.mundo:active { cursor: grabbing; }

.mundo-viewport {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.mundo-canvas {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 0;
  height: 0;
  transform-origin: 0 0;
  will-change: transform;
}

.mundo-carta {
  position: absolute;
  width: 150px;
  height: 210px;
  margin-left: -75px;
  margin-top: -105px;
  background: rgba(255, 255, 255, .16);
  border: 1px solid rgba(255, 255, 255, .55);
  border-radius: 20px;
  box-shadow: 0 22px 46px rgba(27, 26, 25, .22);
  backdrop-filter: blur(1px);
}

.mundo-fechar {
  position: fixed;
  top: 18px;
  left: 18px;
  right: auto;
  background: rgba(255, 255, 255, .28);
  color: #fff;
  z-index: 31;
}
.mundo-fechar:hover { background: rgba(255, 255, 255, .42); color: #fff; }

.mundo-zoom {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 31;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.zbt {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 0;
  background: rgba(255, 255, 255, .28);
  color: #fff;
  font-size: 22px;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background .2s ease, transform .18s cubic-bezier(.2, .8, .2, 1);
}
.zbt:hover { background: rgba(255, 255, 255, .42); }
.zbt:active { transform: scale(.92); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001s !important; transition-duration: .001s !important; }
}
