:root {
  --fundo: #1a0a13;
  --fundo-2: #26101d;
  --superficie: #2f1424;
  --superficie-2: #3b1a2e;
  --borda: #55304a;
  --texto: #fff4fa;
  --texto-2: #d9bfcd;
  --vermelho: #e51e3a;
  --vermelho-2: #ff3d58;
  --limao: #d4d800;
  --limao-claro: #e5e468;
  --erro: #ff8a8a;
  --raio: 18px;
  --fonte: "Archivo", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  background:
    radial-gradient(120% 60% at 50% -10%, #5a1530 0%, transparent 60%),
    radial-gradient(90% 50% at 100% 100%, #3a0f22 0%, transparent 70%),
    var(--fundo);
  color: var(--texto);
  font: 400 16px/1.5 var(--fonte);
  display: flex;
  flex-direction: column;
}
button, input, textarea { font: inherit; color: inherit; }
img { max-width: 100%; }
[hidden] { display: none !important; }

.listra { display: block; width: 100%; height: auto; pointer-events: none; user-select: none; }
.listra-rodape { margin-top: auto; }

.topo {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 64px;
  padding: 10px 64px;
}
.logo { width: min(200px, 48vw); height: auto; }
.voltar {
  position: absolute; left: 12px; top: 50%; translate: 0 -50%;
  width: 44px; height: 44px; border-radius: 50%;
  border: 1px solid var(--borda); background: var(--superficie);
  display: grid; place-items: center; cursor: pointer;
}
.voltar svg { width: 22px; height: 22px; }
.passo { position: absolute; right: 16px; top: 50%; translate: 0 -50%; font-size: 13px; color: var(--texto-2); font-variant-numeric: tabular-nums; }

.aviso-teste {
  margin: 0 16px 8px; padding: 8px 12px; border-radius: 10px;
  background: #4a3b00; color: #fff3b0; font-size: 13px; text-align: center;
}

main { width: 100%; max-width: 560px; margin: 0 auto; padding: 4px 16px 32px; }
.tela { animation: entrar .28s ease-out; }
@keyframes entrar { from { opacity: 0; transform: translateY(8px); } }
@media (prefers-reduced-motion: reduce) { .tela, .gerando-icone { animation: none !important; } }

h1, h2 { font-stretch: 112%; font-weight: 900; letter-spacing: -.01em; line-height: 1.05; margin: 0 0 12px; }
h1 { font-size: clamp(34px, 10vw, 48px); text-transform: uppercase; }
h2 { font-size: 26px; }
.lead { color: var(--texto-2); font-size: 17px; margin: 0; }
.nota { color: var(--texto-2); font-size: 14px; margin: 0 0 16px; }
.opcional { font-weight: 500; font-size: 12px; color: var(--texto-2); margin-left: 6px; text-transform: none; letter-spacing: 0; }

/* Início */
.hero { text-align: center; padding: 8px 0 24px; }
.hero-icone { width: 112px; height: 112px; margin-bottom: 12px; filter: drop-shadow(0 10px 30px rgba(229,30,58,.45)); }
.escolhas-modo { display: grid; gap: 12px; }
.cartao-modo {
  display: flex; align-items: center; gap: 14px; text-align: left;
  width: 100%; padding: 18px 16px; border-radius: var(--raio);
  background: var(--superficie); border: 1.5px solid var(--borda); cursor: pointer;
  transition: border-color .15s, background .15s, transform .1s;
}
.cartao-modo:hover { border-color: var(--limao); }
.cartao-modo:active { transform: scale(.985); }
.cartao-modo:first-child { background: linear-gradient(135deg, var(--vermelho), #b3142d); border-color: transparent; }
.cartao-icone { flex: none; width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; background: rgba(255,255,255,.14); }
.cartao-modo:not(:first-child) .cartao-icone { background: rgba(212,216,0,.14); color: var(--limao); }
.cartao-icone svg { width: 26px; height: 26px; }
.cartao-texto { display: grid; gap: 2px; }
.cartao-texto strong { font-size: 17px; font-weight: 800; line-height: 1.2; }
.cartao-texto span { font-size: 14px; color: rgba(255,244,250,.8); }

.campo-codigo { margin-top: 16px; display: grid; gap: 6px; }
.campo-codigo input, textarea {
  width: 100%; padding: 12px 14px; border-radius: 12px;
  border: 1.5px solid var(--borda); background: var(--fundo-2); font-size: 16px;
}
textarea { resize: vertical; min-height: 84px; }
input:focus-visible, textarea:focus-visible, button:focus-visible, .botao:focus-within { outline: 3px solid var(--limao); outline-offset: 2px; }

.privacidade { margin-top: 24px; padding: 12px 14px; border-radius: 14px; background: rgba(255,255,255,.04); font-size: 14px; color: var(--texto-2); }
.privacidade summary { cursor: pointer; font-weight: 700; color: var(--texto); }
.privacidade ul { padding-left: 18px; margin: 10px 0 0; display: grid; gap: 6px; }

/* Foto */
.dicas { list-style: none; padding: 0; margin: 0 0 16px; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.dicas li { font-size: 13px; line-height: 1.3; padding: 10px 10px 10px 32px; border-radius: 12px; background: var(--superficie); position: relative; }
.dicas li::before { content: "✓"; position: absolute; left: 11px; top: 9px; color: var(--limao); font-weight: 900; }
.foto-area { aspect-ratio: 3/4; max-height: 38vh; margin: 0 auto 12px; border-radius: var(--raio); overflow: hidden; background: var(--fundo-2); border: 1.5px dashed var(--borda); display: grid; place-items: center; }
.foto-area img { width: 100%; height: 100%; object-fit: cover; }
.foto-vazia { display: grid; justify-items: center; gap: 6px; color: var(--texto-2); font-size: 14px; }
.foto-vazia svg { width: 64px; height: 64px; opacity: .6; }
.botoes-foto { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 16px; }

.consentimento { display: flex; gap: 12px; align-items: flex-start; padding: 14px; border-radius: 14px; background: var(--superficie); font-size: 14px; color: var(--texto-2); cursor: pointer; }
.consentimento input { flex: none; width: 22px; height: 22px; margin: 1px 0 0; accent-color: var(--limao); }

.problemas { margin-top: 14px; padding: 14px; border-radius: 14px; background: rgba(229,30,58,.14); border: 1px solid rgba(255,61,88,.45); font-size: 14px; }
.problemas strong { display: block; margin-bottom: 6px; }
.problemas ul, .problemas-lista { margin: 0; padding-left: 18px; display: grid; gap: 6px; }
.problemas .leve { color: var(--texto-2); }

/* Grupos de opções */
.grupo { margin-bottom: 20px; }
.grupo-titulo { display: block; font-weight: 800; font-size: 13px; letter-spacing: .06em; text-transform: uppercase; margin-bottom: 10px; color: var(--limao-claro); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 44px; padding: 8px 14px; border-radius: 999px;
  border: 1.5px solid var(--borda); background: var(--superficie);
  font-size: 15px; cursor: pointer; transition: background .12s, border-color .12s;
}
.chip[aria-pressed="true"], .chip[aria-checked="true"] { background: var(--texto); color: var(--fundo); border-color: var(--texto); font-weight: 700; }
.chip[aria-pressed="true"]::before, .chip[aria-checked="true"]::before { content: "✓"; font-weight: 900; }
.chip:disabled { opacity: .4; cursor: not-allowed; }
.amostra { display: inline-flex; flex: none; width: 20px; height: 20px; border-radius: 50%; overflow: hidden; box-shadow: inset 0 0 0 1.5px rgba(255,255,255,.35); }
.amostra i { flex: 1; }
.contador { text-align: right; font-size: 12px; color: var(--texto-2); margin-top: 4px; }

/* Resumo */
.resumo { display: grid; gap: 2px; border-radius: var(--raio); overflow: hidden; margin-bottom: 14px; }
.resumo-foto { display: flex; gap: 14px; align-items: center; padding: 12px; background: var(--superficie); }
.resumo-foto img { width: 64px; height: 84px; object-fit: cover; border-radius: 10px; }
.resumo-linha { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; align-items: center; padding: 12px 14px; background: var(--superficie); }
.resumo-linha dt { font-size: 12px; color: var(--texto-2); text-transform: uppercase; letter-spacing: .05em; }
.resumo-linha dd { margin: 0; grid-column: 1; font-weight: 600; }
.resumo-linha .link { grid-row: 1 / span 2; grid-column: 2; }

/* Botões */
.acoes { display: grid; gap: 10px; margin-top: 20px; }
.botao {
  display: inline-flex; align-items: center; justify-content: center; text-align: center;
  min-height: 52px; padding: 12px 20px; border-radius: 14px; border: 0;
  font-weight: 800; font-size: 16px; cursor: pointer; transition: transform .1s, opacity .15s;
}
.botao:active { transform: scale(.98); }
.botao:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.primario { background: var(--limao); color: #1a1500; }
.secundario { background: var(--superficie-2); color: var(--texto); border: 1.5px solid var(--borda); }
.terciario { background: transparent; color: var(--texto-2); text-decoration: underline; text-underline-offset: 3px; }
.link { background: none; border: 0; padding: 0; color: var(--limao-claro); font-weight: 700; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; font-size: inherit; }
.restantes { margin: 0; text-align: center; font-size: 13px; color: var(--texto-2); }

/* Gerando */
.gerando { display: grid; justify-items: center; text-align: center; padding: 32px 0; gap: 10px; }
.gerando-icone { width: 128px; height: 128px; animation: pulsar 1.6s ease-in-out infinite; }
@keyframes pulsar { 50% { transform: scale(1.08) rotate(-6deg); } }
.gerando-etapa { font-size: 20px; font-weight: 800; margin: 12px 0 4px; min-height: 30px; }
.barra { width: 100%; max-width: 320px; height: 8px; border-radius: 99px; background: var(--superficie-2); overflow: hidden; margin-bottom: 8px; }
.barra span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--vermelho), var(--limao)); border-radius: inherit; transition: width .8s linear; }
.erro { padding: 16px 0; }
.erro p { color: var(--texto-2); }

/* Resultado */
.formatos { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 4px; border-radius: 14px; background: var(--superficie); margin-bottom: 14px; }
.formatos button { min-height: 40px; border: 0; border-radius: 10px; background: transparent; font-weight: 700; font-size: 14px; cursor: pointer; color: var(--texto-2); }
.formatos button[aria-checked="true"] { background: var(--texto); color: var(--fundo); }
.palco { display: grid; place-items: center; }
.palco canvas { display: block; max-width: 100%; max-height: 62vh; width: auto; height: auto; border-radius: 14px; box-shadow: 0 20px 50px rgba(0,0,0,.45); }
.selo-ficticio { margin: 12px 0 0; padding: 10px 12px; border-radius: 12px; background: rgba(212,216,0,.12); color: var(--limao-claro); font-size: 13px; text-align: center; }
.avisos { margin-top: 12px; padding: 12px 14px; border-radius: 12px; background: rgba(255,200,0,.1); border: 1px solid rgba(255,200,0,.35); font-size: 14px; display: grid; gap: 6px; }

/* Visualização 3D */
.vistas { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 4px; margin-bottom: 12px; border-radius: 14px; background: var(--superficie); }
.vistas button { min-height: 44px; border: 0; border-radius: 10px; background: transparent; color: var(--texto-2); font: 800 15px/1 var(--fonte); cursor: pointer; }
.vistas button[aria-selected="true"] { background: var(--limao); color: #1a1500; }
.palco-3d { position: relative; aspect-ratio: 3/4; max-height: 70vh; margin: 0 auto 12px; border-radius: var(--raio); overflow: hidden;
  background: radial-gradient(80% 60% at 50% 35%, #4a1a34 0%, #1f0c17 75%); }
.visor-3d, .visor-3d model-viewer { width: 100%; height: 100%; }
.visor-3d model-viewer { --poster-color: transparent; background: transparent; }
.carregando-3d { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 12px; padding: 24px; text-align: center; }
.carregando-3d .nota { margin: 0; }
.giro { width: 54px; height: 54px; border-radius: 50%; border: 5px solid var(--superficie-2); border-top-color: var(--limao); animation: girar 1s linear infinite; }
@keyframes girar { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .giro { animation-duration: 3s; } }
.dica-3d { position: absolute; left: 0; right: 0; bottom: 12px; margin: 0; text-align: center; font-size: 13px; font-weight: 700; color: var(--texto); text-shadow: 0 1px 4px #000; pointer-events: none; }

/* Câmera */
.camera { position: fixed; inset: 0; z-index: 20; background: #000; display: grid; grid-template-rows: 1fr auto; }
.camera[hidden] { display: none; }
.camera-visor { position: relative; min-height: 0; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 12px;
  padding: env(safe-area-inset-top) 0 6px; }
/* Quadro colado no topo, perto da lente frontal: o olhar fica perto da câmera e o rosto sai de frente, sem precisar abaixar o celular. */
/* 3:4 como a foto final. Antes o vídeo enchia a tela (bem mais alta que 3:4) e o navegador ampliava a imagem cortando as laterais. */
.camera-quadro { position: relative; width: min(100vw, calc((100dvh - 210px) * .75)); aspect-ratio: 3 / 4; overflow: hidden; border-radius: 18px; background: #111; }
.camera-quadro video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.camera-quadro video.espelhado { transform: scaleX(-1); }
/* Guia de retrato: rosto no terço de cima, ombros perto da base, como no enquadramento "do peito para cima". */
.camera-guia { position: absolute; inset: 0; pointer-events: none; }
.camera-rosto { position: absolute; left: 50%; top: 12%; width: 42%; aspect-ratio: 3 / 4; transform: translateX(-50%); border-radius: 50%;
  border: 3px dashed rgba(229,228,104,.9); box-shadow: 0 0 0 100vmax rgba(0,0,0,.28); }
.camera-ombros { position: absolute; left: 50%; bottom: -14%; width: 92%; aspect-ratio: 2 / 1; transform: translateX(-50%);
  border: 3px dashed rgba(229,228,104,.6); border-bottom: 0; border-radius: 50% 50% 0 0 / 100% 100% 0 0; }
.camera-dica { margin: 0; padding: 0 16px; text-align: center; font-size: 14px; line-height: 1.35; font-weight: 700; color: var(--texto); }
.camera-controles {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px;
  padding: 16px 16px calc(16px + env(safe-area-inset-bottom)); background: var(--fundo);
}
.camera-controles .botao { color: var(--texto); }
.camera-controles [data-acao="virar-camera"] { justify-self: end; }
.camera-controles [data-acao="fechar-camera"] { justify-self: start; }
.camera-disparo { width: 72px; height: 72px; border-radius: 50%; border: 5px solid var(--texto); background: var(--limao); cursor: pointer; }
.camera-disparo:active { transform: scale(.94); }
.camera-disparo:disabled { opacity: .4; }

.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); translate: -50% 0;
  max-width: calc(100% - 32px); padding: 12px 18px; border-radius: 12px;
  background: var(--texto); color: var(--fundo); font-weight: 700; font-size: 14px;
  box-shadow: 0 10px 30px rgba(0,0,0,.4); z-index: 10;
}

@media (min-width: 720px) {
  main { padding-top: 16px; }
  .acoes-resultado { grid-template-columns: 1fr 1fr; }
  .acoes-resultado .primario, .acoes-resultado .terciario, .acoes-resultado .restantes { grid-column: 1 / -1; }
}

/* Customizar o look */
.palco { position: relative; }
.palco canvas.trocou { animation: revelar .6s ease; }
@keyframes revelar { from { opacity: .35; filter: blur(8px); } }
.editando { position: absolute; inset: 0; margin: auto; display: grid; place-content: center; justify-items: center; gap: 8px; padding: 16px; text-align: center;
  background: rgba(26,10,19,.55); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); border-radius: 14px; }
.editando .nota { font-size: 13px; color: var(--texto-2); }
.editando .botao { min-height: 44px; }
.barra-versao { display: flex; justify-content: center; align-items: center; gap: 14px; margin-top: 10px; font-size: 14px; color: var(--texto-2); }
.barra-versao .link { min-height: 44px; }
.botao-customizar { width: 100%; margin-top: 14px; }
.acoes-resultado[inert], .vistas[inert], .formatos[inert] { opacity: .5; }

.editor { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; width: 100%; max-width: 560px; margin: 0 auto;
  display: flex; flex-direction: column; max-height: 46vh; padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: var(--fundo-2); border: 1px solid var(--borda); border-bottom: 0; border-radius: 22px 22px 0 0;
  box-shadow: 0 -18px 40px rgba(0,0,0,.5); animation: subir .25s ease; }
@keyframes subir { from { transform: translateY(100%); } }
.editor-topo { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.fechar { width: 44px; height: 44px; margin-right: -10px; border: 0; background: none; color: var(--texto-2); font-size: 18px; cursor: pointer; }
.editor-abas { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; margin: 0 -16px 10px; padding: 2px 16px; }
.editor-abas::-webkit-scrollbar { display: none; }
.editor-abas button { flex: none; display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 14px; border-radius: 999px;
  border: 1px solid var(--borda); background: transparent; color: var(--texto-2); font: 700 14px/1 var(--fonte); cursor: pointer; }
.editor-abas button[aria-selected="true"] { background: var(--texto); color: var(--fundo); border-color: var(--texto); }
.editor-abas .n { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 99px; background: var(--vermelho); color: #fff; font-size: 11px; }
.editor-corpo { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.editor-corpo .grupo { margin-bottom: 6px; }
.editor-corpo .grupo-titulo { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.editor-dica { margin: 8px 0 0; font-size: 12px; color: var(--texto-2); }
.editor-rodape { display: flex; gap: 12px; align-items: center; justify-content: space-between; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--borda); }
.editor-resumo { font-size: 13px; color: var(--texto-2); }
.editor-rodape .botao { min-height: 46px; padding: 0 24px; }
/* Com o editor aberto, o avatar encolhe para continuar visível acima do painel. */
body.com-editor .palco canvas { max-height: 40vh; }
body.com-editor [data-tela="resultado"] { padding-bottom: 48vh; }
@media (prefers-reduced-motion: reduce) { .editor, .palco canvas.trocou { animation: none; } }
.editor { max-height: 52vh; }
.editor-corpo .chips { gap: 6px; }
.editor-corpo .chip { min-height: 40px; padding: 0 12px; font-size: 14px; }
body.com-editor .palco canvas { max-height: 36vh; }
body.com-editor [data-tela="resultado"] { padding-bottom: 54vh; }

/* Rede social: link para o feed, publicar e usar como foto do perfil */
.ir-feed { position: absolute; right: 16px; top: 50%; transform: translateY(-50%); padding: 8px 14px; border-radius: 999px;
  background: rgba(255,244,250,.08); border: 1px solid rgba(255,244,250,.14); color: var(--texto); font-weight: 800; font-size: 13px; text-decoration: none; }
.ir-feed:hover { background: rgba(255,244,250,.16); }
.acoes-sociais { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }
.acoes-sociais .botao { min-height: 48px; font-size: 15px; }
.dialogo { position: fixed; inset: 0; z-index: 60; display: grid; place-items: end center; background: rgba(10,3,7,.7); backdrop-filter: blur(4px); }
.dialogo[hidden] { display: none; }
.dialogo-caixa { width: 100%; max-width: 520px; max-height: 92dvh; overflow-y: auto; padding: 20px 18px calc(20px + env(safe-area-inset-bottom));
  background: var(--fundo-2); border: 1px solid var(--borda); border-radius: 24px 24px 0 0; animation: subir .25s ease; }
.dialogo-caixa h2 { margin: 0 0 12px; font-size: 20px; }
.dialogo-previa { display: block; width: 100%; max-height: 38vh; object-fit: contain; border-radius: 14px; background: #000; margin-bottom: 14px; }
.dialogo-caixa textarea { width: 100%; padding: 12px 14px; border-radius: 14px; border: 1.5px solid var(--borda); background: var(--superficie); color: var(--texto); font: inherit; resize: vertical; }
@media (min-width: 640px) { .dialogo { place-items: center; } .dialogo-caixa { border-radius: 24px; } }
.passo { right: 92px; }
