/* Colinha AI — pensado para leitura fácil: letra grande, alto contraste, alvos de toque grandes. */
:root {
  --fundo: #f4f1ea;
  --cartao: #ffffff;
  --tinta: #111318;
  --tinta-2: #3d4250;
  --linha: #cfc9bb;
  --verde: #17813f;
  --verde-escuro: #11682f;
  --laranja: #c75a12;
  --vermelho: #b3261e;
  --ambar: #8a5a00;
  --raio: 16px;
  --sombra: 0 1px 3px rgb(0 0 0 / .1), 0 4px 16px rgb(0 0 0 / .06);
  color-scheme: light;
  font-size: 20px;
}
:root.letra-grande { font-size: 24px; }

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--fundo);
  color: var(--tinta);
  font: 1rem/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  padding-bottom: calc(6rem + env(safe-area-inset-bottom));
}
button, input, select { font: inherit; color: inherit; }
h1 { font-size: 1.6rem; line-height: 1.2; margin: .2rem 0 .4rem; }
h2 { font-size: 1.3rem; line-height: 1.25; margin: 0 0 .4rem; }
h3 { font-size: 1.05rem; margin: 1.2rem 0 .5rem; }
.sub { color: var(--tinta-2); margin: 0 0 1rem; }
.passo { font-weight: 700; color: var(--verde); margin: 0; text-transform: uppercase; letter-spacing: .05em; font-size: .85rem; }
:focus-visible { outline: 4px solid #1a73e8; outline-offset: 2px; }

.topo {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between; gap: .6rem;
  padding: calc(.5rem + env(safe-area-inset-top)) 16px .5rem;
  background: #1b1f2a; color: #fff;
}
.marca { display: flex; align-items: center; gap: .5rem; font-size: 1.1rem; }
.marca img { border-radius: 8px; }
.btn-topo {
  background: #2c3240; color: #fff; border: 2px solid #4a5163; border-radius: 12px;
  padding: .35rem .7rem; font-weight: 700; font-size: .85rem; min-height: 2.4rem; cursor: pointer;
}
.btn-topo[aria-pressed="true"] { background: #fff; color: #1b1f2a; }

main { max-width: 680px; margin: 0 auto; padding: 16px; }
.tela { display: grid; grid-template-columns: minmax(0, 1fr); gap: .6rem; }
.cartao { background: var(--cartao); border-radius: var(--raio); padding: 1rem; box-shadow: var(--sombra); }
.cartao.destaque { border: 3px solid var(--verde); display: grid; gap: .6rem; }
.cartao.destaque .sub { margin: 0; }

/* Passo 1: estados */
.grade { display: grid; grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr)); gap: .5rem; }
.grade button {
  min-height: 3.2rem; padding: .5rem .7rem; text-align: left; border-radius: 12px; cursor: pointer;
  background: var(--cartao); border: 2px solid var(--linha); font-weight: 650; line-height: 1.2;
}
.grade button:hover, .grade button:focus-visible { border-color: var(--tinta); }
.grade button small { display: block; font-weight: 500; color: var(--tinta-2); font-size: .8rem; }

/* Passo 2: partidos */
.lista-partidos { display: grid; gap: .5rem; margin-top: .4rem; }
.partido-btn {
  display: grid; grid-template-columns: 3.4rem minmax(0, 1fr); gap: .8rem; align-items: center;
  padding: .5rem; border-radius: 14px; border: 2px solid var(--linha); background: var(--cartao);
  text-align: left; cursor: pointer; min-height: 4rem;
}
.partido-btn:hover, .partido-btn:focus-visible { border-color: var(--tinta); }
.partido-num {
  width: 3.4rem; height: 3.4rem; border-radius: 10px; display: grid; place-items: center;
  font: 800 1.35rem/1 ui-monospace, Menlo, Consolas, monospace; color: #fff;
}
.partido-btn strong { display: block; font-size: 1.1rem; }
.partido-btn small { display: block; color: var(--tinta-2); font-size: .85rem; line-height: 1.25; }

/* Resumo estado/partido */
.resumo {
  display: grid; gap: .3rem; background: var(--cartao); border-radius: var(--raio); padding: .7rem 1rem; box-shadow: var(--sombra);
}
.resumo > div { display: flex; align-items: baseline; gap: .5rem; flex-wrap: wrap; }
.resumo .rotulo { color: var(--tinta-2); min-width: 4.2rem; }
.link { background: none; border: 0; color: #0b57d0; text-decoration: underline; font-weight: 650; cursor: pointer; padding: .3rem; margin-left: auto; }

/* Colinha */
.colinha { list-style: none; margin: 0; padding: 0; display: grid; gap: .6rem; }
.slot {
  display: grid; grid-template-columns: 4rem minmax(0, 1fr); gap: .8rem; align-items: center;
  width: 100%; text-align: left; padding: .7rem; border-radius: 14px; cursor: pointer;
  border: 3px dashed var(--linha); background: var(--cartao); box-shadow: var(--sombra);
}
.slot.cheio { border-style: solid; border-color: var(--verde); }
.slot:hover { border-color: var(--tinta-2); }
.slot .cargo { font-weight: 800; font-size: .95rem; }
.slot .cargo small { font-weight: 500; color: var(--tinta-2); }
.slot .nome { font-weight: 700; font-size: 1.1rem; line-height: 1.2; margin-top: .15rem; }
.slot .vazio { color: var(--verde); font-weight: 700; margin-top: .15rem; }
.slot .partido { color: var(--tinta-2); font-size: .9rem; }
.slot .digitos { margin-top: .35rem; }

.foto {
  width: 4rem; height: 5rem; border-radius: 10px; background: #e2ddd0; overflow: hidden;
  display: grid; place-items: center; font-weight: 800; color: var(--tinta-2); font-size: 1.2rem;
}
.foto img { width: 100%; height: 100%; object-fit: cover; display: block; }
.foto.legenda { color: #fff; font: 800 1.3rem/1 ui-monospace, Menlo, Consolas, monospace; }
.foto.vazia { font-size: 2rem; color: var(--verde); background: #e6f2ea; }

.digitos { display: flex; gap: .2rem; }
.digitos span {
  width: 1.6rem; height: 2.1rem; display: grid; place-items: center;
  border: 2px solid var(--tinta); border-radius: 5px; background: #fff;
  font: 800 1.3rem/1 ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
.digitos.vazio span { border-color: var(--linha); }
.digitos span.sobra { border-style: dashed; border-color: var(--linha); }
.digitos.grande span { width: 2.4rem; height: 3.1rem; font-size: 2rem; border-radius: 7px; }

/* Escolher candidato */
#q {
  width: 100%; padding: .8rem 1rem; border-radius: 14px; border: 3px solid var(--tinta-2);
  background: #fff; font-size: 1.1rem; min-height: 3.2rem; margin-bottom: .4rem;
}
#q:focus { border-color: #1a73e8; outline: none; }
.lista { list-style: none; margin: 0; padding: 0; display: grid; gap: .5rem; }
.item {
  display: grid; grid-template-columns: 4rem minmax(0, 1fr) auto; gap: .8rem; align-items: center;
  width: 100%; padding: .6rem; border-radius: 14px; border: 2px solid var(--linha); background: var(--cartao);
  text-align: left; cursor: pointer; min-height: 5.5rem;
}
.item:hover, .item:focus-visible { border-color: var(--tinta); }
.item .nome { font-weight: 700; font-size: 1.05rem; line-height: 1.2; }
.item .meta { color: var(--tinta-2); font-size: .9rem; }
.item .num { font: 800 1.5rem ui-monospace, Menlo, Consolas, monospace; }
.item.legenda-item { border-width: 3px; }
.dica { color: var(--tinta-2); padding: 1rem 0; text-align: center; }

.selo {
  display: inline-block; font-size: .78rem; font-weight: 800; padding: .05rem .5rem; border-radius: 999px; margin-top: .2rem;
}
.selo.ruim { background: #fbe4e2; color: var(--vermelho); }
.selo.atencao { background: #fbefd5; color: var(--ambar); }
.selo.escolhido { background: #dff1e5; color: var(--verde-escuro); }

.aviso {
  padding: .9rem 1rem; border-left: 6px solid var(--laranja); background: #fdf0e6; border-radius: 10px; margin-top: .6rem;
}
.aviso small { display: block; color: var(--tinta-2); margin-top: .4rem; font-size: .8rem; }

/* Botões */
.btn {
  border: 2px solid var(--tinta-2); background: var(--cartao); border-radius: 14px;
  padding: .6rem 1rem; font-weight: 700; cursor: pointer; min-height: 3rem; line-height: 1.25;
}
.btn:disabled { opacity: .55; cursor: default; }
.btn.primario { background: var(--verde); border-color: var(--verde); color: #fff; }
.btn.primario:hover:not(:disabled) { background: var(--verde-escuro); }
.btn.fantasma { border: 0; background: transparent; color: #0b57d0; text-decoration: underline; }
.btn.perigo { color: var(--vermelho); border-color: var(--vermelho); }
.btn.grande { width: 100%; min-height: 3.4rem; font-size: 1.05rem; }
.btn.voltar { border: 0; background: transparent; color: #0b57d0; padding: .4rem 0; font-size: 1.05rem; }
.pilha { display: grid; gap: .6rem; }

.barra {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 4;
  padding: .7rem 16px calc(.7rem + env(safe-area-inset-bottom));
  background: linear-gradient(transparent, var(--fundo) 25%);
}
.barra .btn { max-width: 648px; display: block; margin: 0 auto; box-shadow: 0 6px 20px rgb(23 129 63 / .35); }

/* Diálogos */
dialog {
  border: 0; color: var(--tinta); background: var(--fundo);
  padding: .5rem 16px calc(1.2rem + env(safe-area-inset-bottom));
}
dialog::backdrop { background: rgb(10 12 18 / .6); }
dialog.tela-cheia, dialog.folha {
  width: 100%; max-width: 680px; height: 100%; max-height: 100%; margin: 0 auto; border-radius: 0;
}
@media (min-width: 720px) {
  dialog.folha { height: auto; max-height: 92vh; margin: auto; border-radius: 20px; }
}
.cab-dialogo { position: sticky; top: -.5rem; background: var(--fundo); z-index: 2; padding: .3rem 0; margin-bottom: .3rem; }

.cand-topo { display: grid; grid-template-columns: 7rem minmax(0, 1fr); gap: 1rem; align-items: start; margin-bottom: .6rem; }
.cand-topo .foto { width: 7rem; height: 9rem; border-radius: 14px; font-size: 2rem; }
.cand-topo .cargo { font-weight: 800; color: var(--tinta-2); }
.cand-topo .nome { font-size: 1.45rem; font-weight: 800; line-height: 1.15; margin: .1rem 0 .3rem; }
.cand-topo .completo { font-size: .9rem; color: var(--tinta-2); }
.cand-num { margin: .3rem 0 1rem; }
.cand-num p { margin: 0 0 .3rem; font-weight: 700; }
.cand-info { color: var(--tinta-2); margin: 0 0 1rem; }
.cand-info .alerta { color: var(--vermelho); font-weight: 700; }

.previa { background: #fff; border-radius: 12px; padding: .4rem; margin-bottom: .5rem; box-shadow: var(--sombra); }
.previa img { width: 100%; display: block; border-radius: 8px; }

.pix { text-align: center; }
.pix img { width: 240px; height: 240px; image-rendering: pixelated; background: #fff; border-radius: 8px; }
.pix textarea {
  width: 100%; font: .8rem ui-monospace, Menlo, Consolas, monospace; padding: .5rem; border-radius: 10px;
  border: 2px solid var(--linha); background: #fff; resize: none; margin: .4rem 0;
}
.preco { font-size: 2.2rem; font-weight: 800; margin: .2rem 0; }
.lista-beneficios { padding-left: 1.2rem; margin: .5rem 0 1rem; }
.erro { color: var(--vermelho); font-weight: 700; min-height: 1.2em; }
.passos-pix { text-align: left; padding-left: 1.4rem; margin: .5rem 0 1rem; }
.aguardando { display: flex; align-items: center; gap: .5rem; justify-content: center; font-weight: 700; margin: .8rem 0; }
.aguardando::before {
  content: ""; width: 1.1rem; height: 1.1rem; border-radius: 50%; border: 3px solid var(--linha); border-top-color: var(--verde);
  animation: gira .8s linear infinite;
}
@keyframes gira { to { transform: rotate(360deg); } }

/* Propostas */
.aviso-ia {
  background: #eef3fd; border-left: 6px solid #0b57d0; border-radius: 10px; padding: .6rem .9rem; font-size: .9rem; margin-bottom: .8rem;
}
.propostas { list-style: none; padding: 0; margin: 0 0 1rem; display: grid; gap: .6rem; }
.propostas li { background: var(--cartao); border-radius: 12px; padding: .7rem .9rem; box-shadow: var(--sombra); }
.propostas strong { display: block; }
.propostas li.bloqueada { filter: blur(5px); user-select: none; pointer-events: none; }
.resumo-ia { font-size: 1.05rem; margin: 0 0 .8rem; }
.fontes { font-size: .85rem; color: var(--tinta-2); margin: 1rem 0 0; padding-left: 1.2rem; word-break: break-word; }
.fontes a { color: #0b57d0; }
.carregando { display: grid; gap: .6rem; justify-items: center; text-align: center; padding: 2rem 0; font-weight: 700; }
.carregando::before {
  content: ""; width: 2.4rem; height: 2.4rem; border-radius: 50%; border: 5px solid var(--linha); border-top-color: var(--verde);
  animation: gira .8s linear infinite;
}
.secao-propostas { margin-top: .8rem; }

/* Foto com o candidato */
.foto-upload { display: grid; gap: .7rem; }
.foto-upload input[type=file] { display: none; }
.foto-previa { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; }
.foto-previa figure { margin: 0; text-align: center; font-size: .85rem; color: var(--tinta-2); }
.foto-previa img, .foto-previa .vazia {
  width: 100%; aspect-ratio: 4 / 5; object-fit: cover; border-radius: 12px; background: #e2ddd0; display: grid; place-items: center;
}
.consentimento { display: flex; gap: .6rem; align-items: flex-start; font-size: .92rem; background: var(--cartao); padding: .7rem; border-radius: 12px; }
.consentimento input { width: 1.6rem; height: 1.6rem; flex: none; margin-top: .1rem; accent-color: var(--verde); }

#toast {
  position: fixed; left: 50%; bottom: calc(5.5rem + env(safe-area-inset-bottom)); transform: translateX(-50%) translateY(20px);
  background: #111318; color: #fff; padding: .8rem 1.2rem; border-radius: 12px; font-weight: 650;
  opacity: 0; pointer-events: none; transition: .2s; z-index: 50; width: max-content; max-width: calc(100% - 32px); text-align: center;
}
#toast.on { opacity: 1; transform: translateX(-50%); }

#impressao { display: none; }
@media print {
  @page { size: A4; margin: 10mm; }
  :root { font-size: 12pt; }
  body { background: #fff; padding: 0; }
  body > *:not(#impressao) { display: none !important; }
  #impressao { display: grid !important; grid-template-columns: 1fr 1fr; gap: 6mm; color: #000; }
  .cola { border: 1px dashed #777; padding: 4mm; font: 11pt/1.3 system-ui, sans-serif; break-inside: avoid; }
  .cola h4 { margin: 0 0 2mm; font-size: 11pt; }
  .cola table { width: 100%; border-collapse: collapse; }
  .cola td { padding: 1.5mm 0; border-bottom: 1px solid #ccc; vertical-align: top; }
  .cola td.n { font: 700 16pt ui-monospace, Menlo, Consolas, monospace; text-align: right; white-space: nowrap; }
  .cola small { color: #333; }
}

/* Rodapé e página de privacidade */
.rodape-legal { margin: 2rem 0 0; font-size: .85em; color: var(--tinta-2); text-align: center; line-height: 1.5; }
.texto-legal { max-width: 44rem; margin: 0 auto; padding: 1.5rem 16px 3rem; line-height: 1.55; }
.texto-legal h2 { margin-top: 1.8rem; }
.texto-legal li { margin: .5rem 0; }

/* PIX copia e cola em destaque */
.pix-opcao { margin: .2rem 0 0; }
.pix-rotulo { display: block; text-align: left; font-weight: 700; margin-top: .4rem; }
.pix textarea { font-size: .95rem; word-break: break-all; }
.pix-qr { margin: .6rem 0; }
.pix-qr summary { cursor: pointer; font-weight: 700; color: #0b57d0; padding: .6rem 0; }

/* Propostas dentro da prévia da colinha */
.previa-propostas { margin-top: 1.6rem; border-top: 3px solid var(--linha); padding-top: 1rem; }
.previa-propostas h3 small { font-weight: 500; color: var(--tinta-2); }
.previa-propostas .secao-propostas { padding: 1rem; }
