:root {
  --vermelho: #C8102E;
  --vermelho-escuro: #8E0A18;
  --fundo: #fff7f5;
  --cartao: #ffffff;
  --texto: #1d1415;
  --texto-suave: #6b5a5c;
  --borda: #f0dcdc;
  --sombra: 0 6px 24px rgba(140, 10, 24, 0.08);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --fundo: #170c0e;
    --cartao: #231416;
    --texto: #fbeeee;
    --texto-suave: #c4a9ac;
    --borda: #3d2427;
    --sombra: 0 6px 24px rgba(0, 0, 0, 0.35);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--fundo);
  color: var(--texto);
  line-height: 1.45;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

.topo {
  background: linear-gradient(135deg, var(--vermelho) 0%, var(--vermelho-escuro) 100%);
  color: #fff;
  padding: calc(20px + env(safe-area-inset-top, 0px)) 16px 22px;
}

.marca {
  max-width: 560px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 14px;
}

.estrela {
  font-size: 40px;
  line-height: 1;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,.25));
}

h1 {
  font-family: "Archivo Black", Impact, "Arial Black", sans-serif;
  font-size: clamp(1.35rem, 5.5vw, 1.8rem);
  margin: 0;
  letter-spacing: -0.01em;
  line-height: 1.1;
}

.sub { margin: 4px 0 0; opacity: .92; font-size: .95rem; }

main {
  max-width: 560px;
  margin: 0 auto;
  padding: 16px;
}

.cartao {
  background: var(--cartao);
  border: 1px solid var(--borda);
  border-radius: 18px;
  padding: 18px;
  margin-bottom: 14px;
  box-shadow: var(--sombra);
}

h2 {
  font-size: 1.1rem;
  margin: 0 0 10px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.num {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--vermelho);
  color: #fff;
  font-size: .9rem;
  font-weight: 800;
  flex: none;
}

.dica { color: var(--texto-suave); font-size: .9rem; margin: 6px 0; }
.centro { text-align: center; }

.botoes, .acoes {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

.acoes { margin-bottom: 14px; }
.acoes .btn { flex: 1 1 200px; }
.botoes .btn { flex: 1 1 180px; }

.btn {
  appearance: none;
  border: 0;
  border-radius: 14px;
  padding: 14px 18px;
  font: inherit;
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  text-align: center;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 52px;
  -webkit-tap-highlight-color: transparent;
  transition: transform .08s ease, filter .15s ease;
}
.btn:active { transform: scale(.98); }
.btn:focus-visible, .chip:focus-visible { outline: 3px solid #ffb703; outline-offset: 2px; }

.btn-primario { background: var(--vermelho); color: #fff; }
.btn-primario:hover { filter: brightness(1.08); }
.btn-secundario { background: transparent; color: var(--vermelho); border: 2px solid var(--vermelho); }
@media (prefers-color-scheme: dark) { .btn-secundario { color: #ff6b7a; border-color: #ff6b7a; } }
.btn-link {
  background: none;
  color: var(--vermelho);
  padding: 8px 0;
  min-height: auto;
  font-size: .95rem;
}
@media (prefers-color-scheme: dark) { .btn-link { color: #ff6b7a; } }
.btn.grande { font-size: 1.1rem; min-height: 58px; }
.btn[disabled] { opacity: .6; pointer-events: none; }

/* Pré-visualização */
.preview-cartao { padding: 14px; }
.preview-wrap {
  position: relative;
  width: 100%;
  max-width: 420px;
  margin: 0 auto;
  aspect-ratio: 1 / 1;
  border-radius: 14px;
  overflow: hidden;
  background:
    repeating-conic-gradient(#e9e2e2 0 25%, #fff 0 50%) 0 0 / 22px 22px;
  transition: border-radius .25s ease;
}
.preview-wrap.circulo { border-radius: 50%; }
#preview {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: grab;
}
#preview:active { cursor: grabbing; }

/* Campos */
.campo {
  display: grid;
  grid-template-columns: 90px 1fr;
  align-items: center;
  gap: 10px;
  margin: 10px 0;
}
.campo label { font-weight: 600; font-size: .95rem; }

input[type="range"] { width: 100%; accent-color: var(--vermelho); height: 32px; }

input[type="text"] {
  width: 100%;
  font: inherit;
  font-size: 16px; /* evita zoom automático no iPhone */
  padding: 10px 12px;
  border-radius: 12px;
  border: 1.5px solid var(--borda);
  background: var(--fundo);
  color: var(--texto);
}
input[type="text"]:focus { outline: none; border-color: var(--vermelho); }

.rotulo { font-weight: 700; margin: 14px 0 8px; font-size: .95rem; }

.opcoes { display: flex; flex-wrap: wrap; gap: 8px; }

.chip {
  appearance: none;
  border: 1.5px solid var(--borda);
  background: var(--fundo);
  color: var(--texto);
  border-radius: 999px;
  padding: 8px 14px;
  font: inherit;
  font-size: .92rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  -webkit-tap-highlight-color: transparent;
}
.chip:disabled { opacity: .35; cursor: not-allowed; }
.chip.ativo { border-color: var(--vermelho); background: var(--vermelho); color: #fff; }

.bolinha {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,.8);
  box-shadow: 0 0 0 1px rgba(0,0,0,.12);
  flex: none;
}

.toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  font-size: .95rem;
  cursor: pointer;
}
.toggle input { width: 20px; height: 20px; accent-color: var(--vermelho); flex: none; }
.preview-cartao .toggle { justify-content: center; }

/* Dica: link nos Stories do Instagram */
.dica-instagram { border-left: 5px solid var(--vermelho); }
.dica-instagram p { margin: 0 0 4px; }
.dica-instagram .passos { margin-top: 6px; }

/* Aviso: navegador interno de apps */
.aviso-app { background: #fff4d6; border-color: #f0c64a; color: #4a3600; }
.aviso-app p { margin: 0 0 8px; }
.aviso-app .dica { color: #5c4300; margin-top: 10px; }
.aviso-app .botoes { margin-top: 6px; }
.aviso-app a.btn { text-decoration: none; }

/* Confirmação da foto */
.confirmar { text-align: center; }
.confirmar h2 { justify-content: center; }
#confirmar-img {
  display: block;
  width: 160px;
  height: 160px;
  margin: 6px auto 4px;
  object-fit: cover;
  border-radius: 50%;
  border: 4px solid var(--vermelho);
}

/* Carregando */
.carregando { text-align: center; padding: 26px 8px; }
.carregando p { margin: 10px 0 0; }
#status-texto { font-weight: 700; font-size: 1.05rem; }
.spinner {
  width: 54px;
  height: 54px;
  margin: 0 auto;
  border-radius: 50%;
  border: 5px solid var(--borda);
  border-top-color: var(--vermelho);
  animation: girar 0.9s linear infinite;
}
@keyframes girar { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 3s; } }

#resultado img {
  display: block;
  width: 100%;
  max-width: 420px;
  margin: 8px auto 0;
  border-radius: 14px;
}

/* Instalar na tela */
.instalar { border: 2px solid var(--vermelho); }
.passos { margin: 10px 0 0; padding-left: 22px; }
.passos li { margin: 8px 0; }
.icone-ios {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background: #007AFF;
  color: #fff;
  font-size: .85rem;
  vertical-align: -5px;
}
.aviso {
  margin: 12px 0 0;
  padding: 10px 12px;
  border-radius: 12px;
  background: #fff4d6;
  color: #5c4300;
  font-size: .92rem;
}

/* Compartilhar o app */
.largura-total { width: 100%; margin-top: 6px; }
.redes {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 8px;
  margin-top: 12px;
}
.rede {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 8px 10px;
  border-radius: 12px;
  background: var(--cor);
  color: #fff;
  font-weight: 700;
  font-size: .92rem;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}
.rede:active { transform: scale(.98); }
@media (prefers-color-scheme: dark) {
  .rede[style*="#000000"] { background: #fff; color: #000; }
}
.copiar-link {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  flex-wrap: wrap;
}
.copiar-link input { flex: 1 1 180px; min-width: 0; }
.copiar-link .btn { flex: 0 0 auto; min-height: 46px; padding: 10px 16px; }

.como-usar ul { padding-left: 18px; margin: 6px 0; }
.como-usar li { margin: 6px 0; }

.rodape {
  max-width: 560px;
  margin: 0 auto;
  padding: 8px 16px 28px;
  text-align: center;
  font-size: .9rem;
}
.rodape p { margin: 4px 0; }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  background: #1d1415;
  color: #fff;
  padding: 12px 18px;
  border-radius: 12px;
  font-size: .95rem;
  max-width: calc(100% - 32px);
  box-shadow: 0 8px 24px rgba(0,0,0,.3);
  z-index: 10;
}

[hidden] { display: none !important; }
