:root {
  --fundo: #efe7dd;
  --papel: #f8f2ea;
  --tomate: #e2492f;
  --tomate-esc: #b9341d;
  --lilas: #cdb9ec;
  --rosa: #f4c6cc;
  --mostarda: #d9a52c;
  --chocolate: #3d1f12;
  --texto: #2b1a12;
  --suave: #7b6558;
  --linha: rgba(61, 31, 18, 0.14);
  --serif: "Instrument Serif", "Times New Roman", serif;
  --sans: "DM Sans", system-ui, -apple-system, sans-serif;
  --mono: "DM Mono", ui-monospace, monospace;
  --blob: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' preserveAspectRatio='none'%3E%3Cpath d='M10 6C28 1 42 9 56 5S94 2 97 18 93 40 96 56 100 90 86 96 58 91 44 96 4 99 2 82 7 62 4 46 0 10 10 6Z'/%3E%3C/svg%3E");
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.5;
  color: var(--texto);
  background: var(--fundo);
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}
button { font: inherit; color: inherit; cursor: pointer; }
[hidden] { display: none !important; }

/* grão de papel */
.grao {
  position: fixed; inset: 0; pointer-events: none; z-index: 20; opacity: .35; mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .24 0 0 0 0 .12 0 0 0 0 .07 0 0 0 .22 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

#app {
  position: relative;
  max-width: 460px;
  margin: 0 auto;
  padding: max(18px, env(safe-area-inset-top)) 18px max(32px, env(safe-area-inset-bottom));
}

.ecra { animation: entrar .55s cubic-bezier(.2, .8, .2, 1) both; }
.ecra--centro { text-align: center; display: flex; flex-direction: column; align-items: center; min-height: calc(100dvh - 60px); justify-content: center; position: relative; }
@keyframes entrar { from { opacity: 0; transform: translateY(14px); } }

/* ── Tipografia ── */
h1, h2, h3 { font-family: var(--serif); font-weight: 400; letter-spacing: -.015em; margin: 0; line-height: .95; }
h1 em, h2 em, h3 em { font-style: italic; }
.etiqueta {
  font-family: var(--mono); font-size: 11.5px; font-weight: 500; letter-spacing: .14em; text-transform: uppercase;
  color: var(--chocolate); margin: 0 0 8px;
}
.texto-suave { color: var(--suave); margin: 10px 0 0; }
.texto-pequeno { font-size: 14px; }
.titulo-seccao { font-size: clamp(44px, 13vw, 58px); color: var(--tomate); margin-top: 26px; }
.titulo-seccao em { color: var(--chocolate); }
.titulo-grande { font-size: clamp(56px, 17vw, 76px); color: var(--tomate); }
.titulo-grande em { color: var(--chocolate); }

/* ── Entrada ── */
.etiqueta--topo { display: flex; justify-content: space-between; border-bottom: 1px solid var(--linha); padding-bottom: 10px; }
.etiqueta--topo span:nth-child(2) { color: var(--tomate); }
.heroi { position: relative; margin: 18px 0 8px; }
.titulo-heroi {
  position: relative; z-index: 2;
  font-size: clamp(52px, 16.5vw, 78px);
  color: var(--tomate);
  line-height: .9;
  text-align: center;
  white-space: nowrap;
  margin-bottom: 14px;
}
.blob {
  display: block; position: relative; width: 100%; aspect-ratio: 1.32; padding: 0;
  background: var(--rosa);
  border: 1.5px solid var(--chocolate);
  border-radius: 30px;
  overflow: hidden;
}
.blob img {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
  opacity: 0; transform: scale(1.06); transition: opacity 1s ease, transform 6s ease-out;
}
.blob img.ativa { opacity: 1; transform: scale(1); }
.blob img.vertical { object-position: 50% 42%; }
.autocolante {
  position: absolute; z-index: 3; right: 0; bottom: -34px;
  background: var(--papel); color: var(--chocolate);
  font-family: var(--mono); font-size: 12px; letter-spacing: .08em; text-transform: uppercase;
  padding: 12px 24px; border-radius: 50%; text-align: center; line-height: 1.35;
  border: 1.5px solid var(--chocolate);
  transform: rotate(-9deg);
  box-shadow: 3px 4px 0 var(--chocolate);
  white-space: nowrap;
}
.asterisco { color: var(--mostarda); position: absolute; }

.arvore-natal {
  display: block; width: 52px; margin: 16px 14px 0 auto;
  transform-origin: 50% 100%; animation: baloicar 5s ease-in-out infinite;
}
@keyframes baloicar { 0%, 100% { transform: rotate(-2.5deg); } 50% { transform: rotate(2.5deg); } }

/* ── Cartões e formulários ── */
.cartao {
  background: var(--papel);
  border-radius: 28px;
  padding: 22px 20px;
  text-align: left;
  border: 1.5px solid var(--chocolate);
}
.cartao h3 { font-size: 34px; color: var(--chocolate); line-height: 1; }
.cartao h3 em { color: var(--tomate); }
.cartao--entrar { margin-top: 26px; }
.cartao--entrar .erro { min-height: 0; margin: 0; }
.cartao--entrar .erro:not(:empty) { margin-top: 10px; }
.cartao--entrar .botao { margin-top: 16px; }
.detalhes--entrada { margin-top: 26px; }
.cartao--lilas { background: var(--lilas); }
.cartao--lilas h3 em { color: var(--tomate-esc); }
.campo { position: relative; }
input, textarea {
  width: 100%;
  font: inherit;
  font-size: 18px;
  color: var(--texto);
  background: #fffdf9;
  border: 1.5px solid var(--linha);
  border-radius: 16px;
  padding: 14px 16px;
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}
input:focus, textarea:focus { border-color: var(--tomate); box-shadow: 0 0 0 4px rgba(226, 73, 47, .14); }
textarea { resize: vertical; min-height: 110px; margin-top: 14px; font-size: 16px; line-height: 1.5; }
.ver-pp {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%); border: 0; background: none; padding: 8px;
  font-family: var(--mono); font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--suave);
}

.botao {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%;
  margin-top: 14px;
  padding: 16px 20px;
  border: 1.5px solid var(--chocolate);
  border-radius: 999px;
  background: var(--tomate);
  color: #fff;
  font-family: var(--serif);
  font-size: 26px;
  line-height: 1;
  box-shadow: 3px 4px 0 var(--chocolate);
  transition: transform .12s, box-shadow .12s, filter .2s;
}
.botao:active { transform: translate(3px, 4px); box-shadow: 0 0 0 var(--chocolate); }
.botao:disabled { filter: saturate(.5) opacity(.7); }
.botao--escuro { background: var(--chocolate); font-size: 22px; padding: 13px; box-shadow: 3px 4px 0 var(--tomate); }
.link-discreto { border: 0; background: none; color: var(--chocolate); text-decoration: underline; text-underline-offset: 4px; font-family: var(--mono); font-size: 12px; letter-spacing: .1em; text-transform: uppercase; padding: 10px; }
.erro { color: var(--tomate-esc); font-size: 15px; min-height: 1.5em; margin: 8px 0 0; }
.ok { color: var(--chocolate); font-family: var(--mono); font-size: 12px; letter-spacing: .1em; text-transform: uppercase; min-height: 1.4em; margin: 10px 0 0; text-align: center; }

/* ── Detalhes do evento ── */
.detalhes { list-style: none; padding: 0; margin: 18px 0 0; display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.detalhes li {
  font-family: var(--mono); font-size: 12px; letter-spacing: .08em; text-transform: uppercase;
  border: 1.5px solid var(--chocolate);
  border-radius: 999px;
  padding: 8px 14px;
  background: var(--mostarda);
}
.detalhes li:nth-child(2) { background: var(--lilas); }
.detalhes li:nth-child(3) { background: var(--mostarda); }
.detalhes--compacto { margin-top: 26px; }

/* ── Faixa do grupo ── */
.faixa-grupo {
  position: relative;
  border-radius: 30px;
  overflow: hidden;
  aspect-ratio: 3 / 2.15;
  background: var(--tomate);
  border: 1.5px solid var(--chocolate);
}
.faixa-grupo__foto { position: absolute; inset: 0; }
.faixa-grupo__foto img { width: 100%; height: 100%; object-fit: cover; }
.faixa-grupo::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 45%, rgba(43, 18, 8, .72)); }
.faixa-grupo__texto { position: absolute; left: 20px; bottom: 16px; z-index: 1; color: var(--papel); }
.faixa-grupo__texto .etiqueta { color: var(--papel); margin: 0 0 4px; }
.faixa-grupo__texto h2 { font-size: 56px; }
.faixa-grupo__texto h2 em { color: var(--rosa); }

/* ── Avatares ── */
.av {
  --tam: 84px;
  width: var(--tam); height: var(--tam);
  border-radius: 50%;
  position: relative;
  overflow: hidden;
  display: grid; place-items: center;
  background: var(--cor, var(--rosa));
  color: var(--chocolate);
  font-family: var(--serif);
  font-size: calc(var(--tam) * .55);
  flex-shrink: 0;
}
.av img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.av--grande { --tam: 120px; border: 1.5px solid var(--chocolate); box-shadow: 4px 5px 0 var(--cor, var(--tomate)); margin-bottom: 20px; overflow: hidden; }
.av--enorme { --tam: 100%; border-radius: 0; font-size: 140px; }

/* ── Grelha de pessoas ── */
.grelha-pessoas { list-style: none; padding: 0; margin: 22px 0 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px 10px; }
.grelha-pessoas button {
  width: 100%; border: 0; background: none; padding: 4px 0;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  transition: transform .15s;
}
.grelha-pessoas button:active { transform: scale(.94); }
.grelha-pessoas .av { border: 1.5px solid var(--chocolate); box-shadow: 3px 4px 0 var(--cor); }
.grelha-pessoas .nome { font-family: var(--serif); font-size: 26px; line-height: 1; margin-top: 4px; }
.grelha-pessoas .estado { font-family: var(--mono); font-size: 10px; letter-spacing: .08em; text-transform: uppercase; color: var(--suave); }
.grelha-pessoas .estado--viu { color: var(--tomate); }
.selo {
  position: absolute; right: -4px; top: -4px; z-index: 2;
  width: 30px; height: 30px;
  color: var(--tomate);
  filter: drop-shadow(1px 1px 0 var(--chocolate));
  animation: girar 10s linear infinite;
}
.pessoa-av { position: relative; }
.progresso { text-align: center; margin: 34px 0 0; }
#botao-lista { display: flex; margin: 22px auto 0; }
#aviso-lista { text-align: left; margin-top: 22px; }
.progresso .etiqueta { color: var(--suave); }
.bolinhas { display: flex; justify-content: center; gap: 8px; margin-top: 4px; }
.bolinhas span { width: 14px; height: 14px; border-radius: 50%; border: 1.5px solid var(--chocolate); background: transparent; transition: background .3s; }
.botao-lista {
  display: inline-flex; align-items: center; gap: 6px; margin-top: 16px;
  padding: 10px 16px; border-radius: 999px; border: 1.5px solid var(--chocolate);
  background: var(--lilas); box-shadow: 3px 4px 0 var(--chocolate);
  font-family: var(--mono); font-size: 12px; letter-spacing: .08em; text-transform: uppercase;
  transition: transform .12s, box-shadow .12s;
}
.botao-lista:active { transform: translate(3px, 4px); box-shadow: 0 0 0 var(--chocolate); }
.aviso-lista {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  margin: 16px 0 0; padding: 10px 8px 10px 16px; border-radius: 18px;
  background: var(--lilas); border: 1.5px solid var(--chocolate); font-size: 15px;
}
.aviso-lista .link-discreto { padding: 6px 8px; flex-shrink: 0; }
.a-escolher .av { animation: pulsar 1.6s ease-in-out infinite; }
@keyframes pulsar { 50% { transform: scale(1.06); } }
#botao-sair-1 { display: block; margin: 14px auto 0; }
.emoji-organizadora {
  display: block; margin: 18px auto 0; border: 0; background: none;
  font-size: 22px; line-height: 1; padding: 10px; opacity: .55; transition: opacity .2s, transform .2s;
}
.emoji-organizadora:active { transform: rotate(90deg) scale(.9); opacity: 1; }
.janela {
  position: fixed; inset: 0; z-index: 30;
  display: grid; place-items: center; padding: 18px;
  background: rgba(61, 31, 18, .45);
  animation: aparecer .25s ease both;
}
.janela .cartao { position: relative; width: 100%; max-width: 420px; box-shadow: 5px 6px 0 var(--chocolate); animation: entrar .35s cubic-bezier(.2, .8, .2, 1) both; }
.janela input { margin-top: 14px; }
.fechar {
  position: absolute; top: 12px; right: 12px; width: 36px; height: 36px; border-radius: 50%;
  border: 1.5px solid var(--chocolate); background: var(--papel); font-size: 20px; line-height: 1;
}
@keyframes aparecer { from { opacity: 0; } }

/* ── Código ── */
.voltar {
  position: absolute; top: 0; left: 0;
  width: 46px; height: 46px; border-radius: 50%;
  border: 1.5px solid var(--chocolate); background: var(--papel);
  font-size: 20px;
}
.titulo-codigo { font-size: 48px; color: var(--tomate); }
.pontos { display: flex; gap: 18px; margin: 28px 0 0; }
.pontos span { width: 18px; height: 18px; border-radius: 50%; border: 1.5px solid var(--chocolate); transition: background .15s, transform .15s; }
.pontos span.cheio { background: var(--tomate); transform: scale(1.15); }
.pontos.abanar { animation: abanar .45s; }
@keyframes abanar { 20%, 60% { transform: translateX(-10px); } 40%, 80% { transform: translateX(10px); } }
.teclado { display: grid; grid-template-columns: repeat(3, 76px); gap: 14px 22px; margin-top: 12px; }
.teclado button {
  width: 76px; height: 76px; border-radius: 50%;
  border: 1.5px solid var(--chocolate);
  background: var(--papel);
  font-family: var(--serif); font-size: 38px; line-height: 1;
  color: var(--chocolate);
  transition: transform .1s, background .1s;
}
.teclado button:active { transform: scale(.92); background: var(--rosa); }
.teclado button[data-t="apagar"] { background: transparent; border: 0; font-family: var(--sans); font-size: 24px; }
.teclado.ocupado { opacity: .5; pointer-events: none; }

/* ── Presente ── */
.presente {
  position: relative; width: 180px; height: 180px; margin: 30px 0 4px;
  border: 0; background: none; padding: 0;
  animation: balancar 2.6s ease-in-out infinite;
}
.presente__caixa, .presente__tampa { border: 1.5px solid var(--chocolate); }
.presente__caixa {
  position: absolute; left: 16px; right: 16px; bottom: 6px; height: 104px;
  background: linear-gradient(90deg, transparent 42%, var(--rosa) 42%, var(--rosa) 58%, transparent 58%), var(--tomate);
  border-radius: 8px 8px 18px 18px;
  box-shadow: 5px 6px 0 var(--chocolate);
}
.presente__tampa {
  position: absolute; left: 6px; right: 6px; top: 50px; height: 34px;
  background: linear-gradient(90deg, transparent 42%, var(--rosa) 42%, var(--rosa) 58%, transparent 58%), var(--tomate);
  border-radius: 10px;
  transition: transform .5s cubic-bezier(.3, 1.6, .5, 1);
  transform-origin: 20% 100%;
}
.presente__laco {
  position: absolute; left: 50%; top: 14px; width: 84px; height: 42px; transform: translateX(-50%);
  transition: transform .5s cubic-bezier(.3, 1.6, .5, 1);
}
.presente__laco::before, .presente__laco::after {
  content: ""; position: absolute; top: 2px; width: 40px; height: 36px;
  background: var(--rosa); border: 1.5px solid var(--chocolate);
  border-radius: 50% 50% 12% 50%;
}
.presente__laco::before { left: 0; transform: rotate(-18deg); }
.presente__laco::after { right: 0; transform: scaleX(-1) rotate(-18deg); }
.presente.aberto { animation: none; }
.presente.aberto .presente__tampa { transform: translate(-10px, -64px) rotate(-26deg); }
.presente.aberto .presente__laco { transform: translate(-60%, -84px) rotate(-30deg); }
@keyframes balancar { 0%, 100% { transform: rotate(-3deg); } 50% { transform: rotate(3deg) translateY(-4px); } }
.dica { margin-top: 14px; color: var(--suave); }

/* ── Roleta (cartaz) ── */
.palco { width: 100%; display: flex; flex-direction: column; align-items: center; }
.roleta { margin: 6px 0 0; width: min(80vw, 310px); }
.cartaz {
  position: relative;
  background: var(--papel);
  border: 1.5px solid var(--chocolate);
  border-radius: 30px;
  padding: 12px 12px 0;
  box-shadow: 5px 6px 0 var(--chocolate);
  transition: background .4s, transform .35s;
}
.cartaz__foto { aspect-ratio: 1; border-radius: 20px; overflow: hidden; background: var(--rosa); position: relative; }
.cartaz__nome { font-family: var(--serif); font-style: italic; font-size: 40px; line-height: 1; text-align: center; margin: 0; padding: 14px 0 18px; color: var(--chocolate); min-height: 1.2em; transition: color .4s; }
.asterisco--cartaz { width: 58px; right: -18px; top: -20px; opacity: 0; transform: scale(.4); transition: opacity .3s, transform .6s cubic-bezier(.2, 1.6, .4, 1); }
.cartaz.passar .cartaz__foto > * { animation: passar .14s ease-out; }
@keyframes passar { from { transform: scale(1.12); filter: blur(4px); opacity: .55; } }
.cartaz.parou { background: var(--tomate); animation: parar .8s cubic-bezier(.2, 1.6, .4, 1) both; }
.cartaz.parou .cartaz__nome { color: var(--papel); }
.cartaz.parou .asterisco--cartaz { opacity: 1; transform: scale(1) rotate(20deg); animation: girar 14s linear infinite .6s; }
@keyframes parar { 0% { transform: scale(1); } 40% { transform: scale(1.07) rotate(-2deg); } 100% { transform: scale(1.02) rotate(-1.5deg); } }

.resultado { margin-top: 26px; animation: entrar .6s .2s cubic-bezier(.2, .8, .2, 1) both; }
.calhou { font-family: var(--serif); font-style: italic; font-size: 28px; color: var(--chocolate); margin: 0; }
.nome-alvo { font-size: clamp(80px, 26vw, 116px); color: var(--tomate); line-height: .9; margin: 2px 0 12px; }

.extras { width: 100%; margin-top: 30px; display: flex; flex-direction: column; gap: 16px; animation: entrar .6s .5s both; }
.desejos-texto { white-space: pre-wrap; margin: 12px 0 0; }
.desejos-texto.vazio { color: var(--chocolate); opacity: .7; font-style: italic; }
.acoes { display: flex; justify-content: space-between; }

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

@media (prefers-reduced-motion: reduce) {
  .presente, .asterisco, .selo, .arvore-natal { animation: none !important; }
}
@media (min-width: 600px) {
  #app { padding-top: 40px; }
}

/* cartão da amiga secreta antes de abrir o presente */
#cartao-alvo.fechado { opacity: .75; border-style: dashed; }
#cartao-alvo.fechado h3 em { color: var(--chocolate); }

/* Área da Admin: separadores e escolha de pessoa */
.separadores { display: flex; gap: 6px; margin: 14px 0 12px; padding: 4px; border: 1.5px solid var(--chocolate); border-radius: 999px; background: var(--fundo); }
.separador { flex: 1; border: 0; border-radius: 999px; padding: 9px 6px; background: transparent; color: var(--chocolate); font-family: var(--mono); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; cursor: pointer; transition: background .2s, color .2s; }
.separador.ativo { background: var(--chocolate); color: var(--papel); }
.escolher-pessoa { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.chip-pessoa { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px 4px 4px; border: 1.5px solid var(--chocolate); border-radius: 999px; background: var(--papel); color: var(--chocolate); font-size: 14px; cursor: pointer; }
.chip-pessoa.ativo { background: var(--tomate); color: var(--papel); }
.av--mini { width: 28px !important; height: 28px !important; border-width: 1.5px !important; box-shadow: none !important; }
