/* ---------- tokens ---------- */
:root {
  --tinta: #f5ede6;
  --tinta-2: #d9cbc2;
  --dourado: #e8b56f;
  --rosa: #ec9db0;
  --fundo: #07060a;
  --luz: 0;
  --curva: cubic-bezier(0.23, 1, 0.32, 1);
  --curva-mover: cubic-bezier(0.77, 0, 0.175, 1);
  --curva-folha: cubic-bezier(0.32, 0.72, 0, 1);
  --rapido: 220ms;
  --padrao: 550ms;
  --lento: 1000ms;
  --serif: 'Cormorant Garamond', 'Times New Roman', serif;
  --mao: 'Caveat', 'Bradley Hand', cursive;
  --topo: env(safe-area-inset-top, 0px);
  --base: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html {
  background: var(--fundo);
  color: var(--tinta);
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  overscroll-behavior: none;
}
body {
  margin: 0;
  min-height: 100svh;
  font-family: var(--serif);
  overflow: hidden;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}
body.dentro { overflow-x: hidden; overflow-y: auto; }
button { font: inherit; color: inherit; }

#fundo {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}
#ceu {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

/* ---------- portão (senha) ---------- */
#portao {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: calc(24px + var(--topo)) 24px calc(24px + var(--base));
  background:
    radial-gradient(120% 70% at 50% 110%, rgba(232, 181, 111, 0.10), transparent 60%),
    radial-gradient(90% 60% at 50% -10%, rgba(236, 157, 176, 0.07), transparent 60%),
    var(--fundo);
}
.portao-oi {
  font-family: var(--mao);
  font-size: 34px;
  line-height: 1.1;
  margin: 0;
  letter-spacing: -0.01em;
}
.portao-dica {
  margin: 0 0 6px;
  text-align: center;
  font-size: 17px;
  line-height: 1.4;
  color: var(--tinta-2);
  font-style: italic;
}
.portao-dica span { font-style: normal; font-size: 14px; letter-spacing: 0.18em; color: var(--dourado); }
.pontos { display: flex; gap: 18px; margin: 4px 0 10px; }
.pontos i {
  width: 13px; height: 13px; border-radius: 50%;
  border: 1px solid rgba(245, 237, 230, 0.45);
  transition: background var(--rapido) var(--curva), box-shadow var(--padrao) var(--curva), transform var(--rapido) var(--curva);
}
.pontos i.on { background: var(--tinta); transform: scale(1.08); }
#portao.certo .pontos i {
  background: var(--dourado);
  border-color: var(--dourado);
  box-shadow: 0 0 18px 4px rgba(232, 181, 111, 0.55), 0 0 40px 10px rgba(236, 157, 176, 0.25);
}
#portao.erro .pontos { animation: treme 420ms var(--curva-mover); }
@keyframes treme {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-10px); }
  40% { transform: translateX(8px); }
  60% { transform: translateX(-5px); }
  80% { transform: translateX(3px); }
}
.teclado {
  display: grid;
  grid-template-columns: repeat(3, 74px);
  gap: 16px 22px;
}
.teclado button {
  width: 74px; height: 74px; border-radius: 50%;
  font-family: var(--serif); font-size: 30px; font-weight: 500; font-variant-numeric: lining-nums;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.10);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16), 0 10px 30px -12px rgba(20, 8, 16, 0.9);
  backdrop-filter: blur(14px) saturate(180%);
  -webkit-backdrop-filter: blur(14px) saturate(180%);
  transition: transform var(--rapido) var(--curva), background var(--rapido) var(--curva);
}
.teclado button[data-apaga] { background: transparent; border-color: transparent; box-shadow: none; font-size: 24px; }
.teclado button.apertado { transform: scale(0.94); background: rgba(255, 255, 255, 0.16); }
#portao.certo .teclado { opacity: 0.15; pointer-events: none; transition: opacity var(--lento) var(--curva); }
#portao.testando .pontos { opacity: 0.6; }
.entrar {
  margin-top: 6px;
  padding: 16px 28px;
  border-radius: 999px;
  font-family: var(--mao); font-size: 26px;
  color: #1a0f0a;
  background: linear-gradient(180deg, #f6d29b, var(--dourado));
  border: 0;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.35) inset, 0 12px 40px -8px rgba(232, 181, 111, 0.6);
  animation: respira 2.4s var(--curva-mover) infinite;
}
.entrar[hidden] { display: none; }
@keyframes respira { 50% { transform: scale(1.04); box-shadow: 0 0 0 1px rgba(255,255,255,.35) inset, 0 16px 60px -6px rgba(232,181,111,.85); } }
.portao-luzes { position: absolute; inset: 0; pointer-events: none; }
.portao-luzes i {
  position: absolute; left: 50%; top: 50%;
  width: 4px; height: 4px; border-radius: 50%;
  background: var(--dourado);
  box-shadow: 0 0 10px 2px rgba(232, 181, 111, 0.7);
  animation: orbita 14s linear infinite;
}
.portao-luzes i:nth-child(2) { animation-duration: 19s; animation-delay: -6s; background: var(--rosa); }
.portao-luzes i:nth-child(3) { animation-duration: 23s; animation-delay: -11s; }
.portao-luzes i:nth-child(4) { animation-duration: 29s; animation-delay: -3s; background: var(--rosa); }
@keyframes orbita {
  from { transform: rotate(0deg) translateX(min(42vw, 190px)) rotate(0deg); }
  to { transform: rotate(360deg) translateX(min(42vw, 190px)) rotate(-360deg); }
}

/* ---------- história ---------- */
#historia { position: relative; z-index: 2; visibility: hidden; }
#historia.visivel { visibility: visible; }

.sec {
  position: relative;
  min-height: 100svh;
  padding: calc(16svh + var(--topo)) 26px calc(16svh + var(--base));
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 28px;
}
.vivo { position: absolute; inset: 0; pointer-events: none; overflow: hidden; z-index: 0; }
.sec > :not(.vivo) { position: relative; z-index: 1; }

.texto { width: 100%; max-width: 30rem; perspective: 700px; }
.par {
  margin: 0 0 1.05em;
  font-size: 20px;
  font-weight: 500;
  line-height: 1.52;
  color: var(--tinta);
  text-wrap: pretty;
}
.par:last-child { margin-bottom: 0; }
.par.lento { font-size: 21px; font-style: italic; color: #efe4dc; }

.data {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.3em;
  font-variant-numeric: lining-nums;
  text-transform: uppercase;
  color: var(--dourado);
  text-align: center;
}

.titulo-cena {
  margin: 0;
  font-family: var(--mao);
  font-weight: 600;
  font-size: 40px;
  line-height: 1.1;
  letter-spacing: -0.01em;
  text-align: center;
  text-wrap: balance;
  color: #fff4ea;
}
.palco { width: min(86vw, 380px); aspect-ratio: 1 / 1; position: relative; }

/* abertura */
.sec-abertura { justify-content: flex-start; gap: 0; padding-top: 0; padding-bottom: 0; }
.frase-bloco { min-height: 62svh; display: flex; align-items: center; justify-content: center; width: 100%; max-width: 26rem; }
.frase-bloco:first-of-type { min-height: 100svh; }
.oi {
  font-family: var(--mao);
  font-size: clamp(64px, 20vw, 110px);
  font-weight: 500;
  line-height: 1.1;
  margin: 0;
  letter-spacing: -0.01em;
  text-shadow: 0 0 40px rgba(236, 157, 176, 0.25);
}
.frase { font-size: 25px; line-height: 1.42; font-weight: 500; text-align: center; margin: 0; text-wrap: balance; }

/* fotos (vidro falso: casca com a própria foto borrada) */
.fotos { display: flex; flex-direction: column; align-items: center; gap: 26px; width: 100%; perspective: 1100px; }
.foto {
  margin: 0;
  width: min(82vw, 400px);
  transform-style: preserve-3d;
  cursor: zoom-in;
}
.foto.deitada { width: min(90vw, 460px); }
.casca {
  position: relative;
  padding: 9px;
  border-radius: 26px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.04) 40%, rgba(255, 255, 255, 0.02)),
    var(--blur) center / cover;
  border: 1px solid rgba(255, 255, 255, 0.10);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.22),
    0 30px 60px -24px rgba(16, 6, 14, 0.85),
    0 0 calc(60px * var(--luz)) calc(-10px + 10px * var(--luz)) rgba(232, 181, 111, calc(0.35 * var(--luz)));
}
.nucleo {
  position: relative;
  overflow: hidden;
  border-radius: 18px;
  aspect-ratio: var(--ar);
  background: var(--blur) center / cover;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.15);
}
.nucleo img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity var(--lento) var(--curva);
}
.foto.carregada .nucleo img { opacity: 1; }
.reflexo {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(115deg, transparent 30%, rgba(255, 255, 255, 0.14) 45%, transparent 60%);
  mix-blend-mode: screen;
  transform: translateX(var(--brilho-x, -30%));
}

/* pedido */
.pedido-palco { position: relative; width: min(84vw, 400px); display: flex; flex-direction: column; align-items: center; gap: 28px; }
.pilha { display: flex; flex-direction: column; gap: 24px; align-items: center; perspective: 1100px; }
.caixinha { width: 120px; height: 100px; position: relative; }

/* línguas e final */
.sec-linguas { padding-top: 30svh; padding-bottom: 30svh; }
.linguas { list-style: none; margin: 0; padding: 0; text-align: center; display: flex; flex-direction: column; gap: 22svh; }
.linguas li { font-family: var(--mao); font-size: 42px; line-height: 1.15; color: #fff2e6; }
.eu-te-amo {
  margin: 0;
  font-family: var(--mao);
  font-weight: 700;
  font-size: clamp(86px, 27vw, 170px);
  line-height: 1;
  letter-spacing: -0.01em;
  text-align: center;
  color: #fff6ea;
  text-shadow: 0 0 30px rgba(255, 214, 160, 0.75), 0 0 80px rgba(236, 157, 176, 0.55);
}
.ultima-bloco { min-height: 100svh; display: flex; align-items: center; justify-content: center; }
.ultima {
  margin: 0;
  font-family: var(--mao);
  font-size: clamp(40px, 11vw, 60px);
  font-weight: 600;
  line-height: 1.12;
  text-align: center;
  text-wrap: balance;
  color: #2a1208;
}

/* aurebesh */
.aurebesh { min-height: 120px; width: min(86vw, 380px); }

/* botão de som */
#mudo {
  position: fixed;
  right: calc(16px + env(safe-area-inset-right, 0px));
  bottom: calc(16px + var(--base));
  z-index: 40;
  width: 44px; height: 44px; border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(20, 12, 16, 0.35);
  backdrop-filter: blur(12px) saturate(180%);
  -webkit-backdrop-filter: blur(12px) saturate(180%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18);
  font-size: 18px;
}
#mudo[hidden] { display: none; }
#mudo.mudo { opacity: 0.55; text-decoration: line-through; }

@media (prefers-reduced-transparency: reduce) {
  .teclado button, #mudo { backdrop-filter: none; -webkit-backdrop-filter: none; background: #1d1519; }
}

/* desktop: centraliza como um celular */
@media (min-width: 700px) {
  #historia { max-width: 480px; margin: 0 auto; }
}
