:root {
  --fundo: #f5f6f7;
  --papel: #ffffff;
  --tinta: #1f2933;
  --suave: #66727f;
  --linha: #e3e6ea;
  --verde: #12a150;
  --verde-escuro: #0d8541;
  --whatsapp: #25d366;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--fundo);
  color: var(--tinta);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}

h1, h2, p { margin: 0; }

.miolo { max-width: 1080px; margin: 0 auto; padding: 0 16px; }

.topo { background: var(--papel); border-bottom: 1px solid var(--linha); }
.topo .miolo { padding-top: 14px; padding-bottom: 14px; font-weight: 700; color: var(--verde-escuro); }

h1 { font-size: 1.6rem; line-height: 1.2; font-weight: 700; margin: 20px 0 16px; text-wrap: balance; }
h2 { font-size: 1.05rem; font-weight: 700; margin-bottom: 10px; }

.grade { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; padding-bottom: 40px; }

/* Foto e vídeo */
.capa { position: relative; background: #000; border-radius: 12px; overflow: hidden; }
.foto { display: block; width: 100%; height: auto; aspect-ratio: 16 / 10; object-fit: cover; }
.video { display: block; width: 100%; max-height: 72vh; background: #000; }
.play {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 64px;
  height: 64px;
  margin: -32px 0 0 -32px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.95);
  cursor: pointer;
}
.play::before {
  content: "";
  position: absolute;
  left: 26px;
  top: 21px;
  border-style: solid;
  border-width: 11px 0 11px 17px;
  border-color: transparent transparent transparent var(--tinta);
}

/* Cartão de doação */
.cartao, .sobre { background: var(--papel); border: 1px solid var(--linha); border-radius: 12px; padding: 20px; }
.cartao { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; }

.rotulo { font-size: 0.85rem; color: var(--suave); }
.arrecadado { font-size: 2rem; line-height: 1.15; font-weight: 700; color: var(--verde-escuro); }
.meta { color: var(--suave); }
.barra { height: 8px; background: var(--linha); border-radius: 99px; overflow: hidden; margin: 12px 0 8px; }
#barra-cheia { height: 100%; width: 0; background: var(--verde); border-radius: 99px; transition: width 0.8s ease; }
.detalhe { display: flex; justify-content: space-between; gap: 12px; font-size: 0.9rem; color: var(--suave); }
.detalhe strong { color: var(--tinta); }

label { display: block; font-size: 0.9rem; font-weight: 600; margin-bottom: 6px; }

.campo {
  display: flex;
  align-items: baseline;
  gap: 8px;
  border: 1px solid #c9ced4;
  border-radius: 8px;
  padding: 0 14px;
}
.campo:focus-within { border-color: var(--verde); box-shadow: 0 0 0 3px rgba(18, 161, 80, 0.15); }
.campo span { font-size: 1.1rem; color: var(--suave); }
.campo input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: none;
  padding: 12px 0;
  font: inherit;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--tinta);
}
.campo input::placeholder { color: #c0c6cc; font-weight: 400; }

.atalhos { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 8px 0 14px; }
.atalhos button {
  border: 1px solid #c9ced4;
  border-radius: 8px;
  background: var(--papel);
  padding: 9px 0;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--tinta);
  white-space: nowrap;
  cursor: pointer;
}
.atalhos button:hover { border-color: var(--verde); }
.atalhos button[aria-pressed="true"] { border-color: var(--verde); background: #e8f6ee; color: var(--verde-escuro); }

.botao {
  display: block;
  width: 100%;
  border: 0;
  border-radius: 8px;
  background: var(--verde);
  color: #fff;
  padding: 15px;
  font: inherit;
  font-size: 1.05rem;
  font-weight: 700;
  cursor: pointer;
}
.botao:hover { background: var(--verde-escuro); }
.botao:disabled { opacity: 0.6; cursor: wait; }

a:focus-visible, button:focus-visible, .codigo:focus-visible { outline: 2px solid var(--tinta); outline-offset: 2px; }

.nota { font-size: 0.82rem; color: var(--suave); text-align: center; margin-top: 8px; }
.erro { color: #b3261e; font-size: 0.9rem; font-weight: 600; margin-top: 8px; }

/* Pix gerado */
.pix { text-align: center; }
.pix-titulo { font-size: 1.1rem; }
.qr { display: block; width: 200px; height: 200px; margin: 12px auto; image-rendering: pixelated; }
.codigo {
  display: block;
  width: 100%;
  border: 1px solid var(--linha);
  border-radius: 8px;
  background: var(--fundo);
  padding: 10px 12px;
  margin-bottom: 8px;
  font-family: ui-monospace, Consolas, monospace;
  font-size: 0.8rem;
  color: var(--suave);
  text-overflow: ellipsis;
}
.aguardando { display: inline-flex; align-items: center; gap: 8px; color: var(--suave); font-size: 0.9rem; margin-top: 14px; }
.pulso { width: 8px; height: 8px; border-radius: 50%; background: var(--verde); animation: pulsar 1.4s ease-in-out infinite; }
.link {
  display: block;
  margin: 4px auto 0;
  border: 0;
  background: none;
  padding: 8px;
  font: inherit;
  font-size: 0.9rem;
  color: var(--verde-escuro);
  text-decoration: underline;
  cursor: pointer;
}

/* Agradecimento */
.sucesso { background: #e8f6ee; border-radius: 8px; padding: 18px 16px 10px; text-align: center; }
.sucesso h2 { font-size: 1.2rem; color: var(--verde-escuro); margin-bottom: 6px; }

/* Quem recebe */
.recebedor { background: var(--fundo); border-left: 4px solid var(--verde); border-radius: 8px; padding: 12px 14px; }
.recebedor span { display: block; font-size: 0.85rem; color: var(--suave); }
.recebedor strong { display: block; font-size: 1.1rem; font-weight: 700; }

/* Compartilhar */
.compartilhar { border-top: 1px solid var(--linha); padding-top: 18px; }
.rede {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  border: 1px solid #c9ced4;
  border-radius: 8px;
  background: var(--papel);
  padding: 11px 10px;
  font: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--tinta);
  text-decoration: none;
  cursor: pointer;
}
.rede:hover { border-color: #9aa3ad; }
.rede svg { flex: none; }
.whatsapp { border-color: var(--whatsapp); background: var(--whatsapp); color: #06351b; padding: 13px 10px; font-weight: 700; }
.whatsapp:hover { border-color: #1fbd5a; background: #1fbd5a; }
.redes { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }

/* Sobre */
.sobre p + p { margin-top: 10px; }
.sobre p { color: #3d4955; }

@keyframes pulsar {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.25; }
}

@media (min-width: 880px) {
  h1 { font-size: 2rem; margin: 28px 0 20px; }
  .grade {
    grid-template-columns: minmax(0, 1fr) 380px;
    grid-template-areas: "capa cartao" "sobre cartao";
    grid-template-rows: auto 1fr;
    gap: 24px;
    align-items: start;
    padding-bottom: 56px;
  }
  .capa { grid-area: capa; }
  .sobre { grid-area: sobre; }
  .cartao { grid-area: cartao; position: sticky; top: 16px; padding: 24px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
