/* Paleta do site: azul-marinho e dourado */
:root {
  --marinho: #0B1E3F;
  --marinho-escuro: #061228;
  --dourado: #D4AF37;
  --dourado-claro: #F3D77A;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  width: 100%;
  height: 100%;
  height: 100dvh;  /* altura real da tela no celular (sem contar a barra do navegador) */
  background: var(--marinho-escuro);
  color: #fff;
  font-family: "Trebuchet MS", Verdana, Arial, sans-serif;
  overflow: hidden;
  overscroll-behavior: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

body {
  display: flex;
  flex-direction: column;
}

#cabecalho {
  flex: 0 0 auto;
  text-align: center;
  padding: 8px 16px 6px;
  background: var(--marinho);
  border-bottom: 2px solid var(--dourado);
}

#cabecalho h1 {
  color: var(--dourado-claro);
  font-size: clamp(16px, 3vw, 30px);
  text-shadow: 2px 2px 0 #000;
  letter-spacing: 0.5px;
}

#cabecalho p {
  font-size: clamp(11px, 1.4vw, 15px);
  opacity: 0.9;
}

#jogo {
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  touch-action: none;
}

#jogo canvas {
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

/* Em telas baixas (celular deitado) o cabeçalho sai e o jogo ocupa a tela toda */
@media (max-height: 500px) {
  #cabecalho { display: none; }
  #jogo { position: fixed; inset: 0; }
}

/* Aviso para girar o celular */
#girar {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 10;
  background: var(--marinho);
  color: var(--dourado-claro);
  align-items: center;
  justify-content: center;
  flex-direction: column;
  text-align: center;
  padding: 24px;
  font-size: 20px;
  gap: 24px;
}

#girar small { color: #fff; font-size: 14px; }

.icone-girar {
  width: 60px;
  height: 100px;
  border: 4px solid var(--dourado);
  border-radius: 10px;
  animation: girar 2s ease-in-out infinite;
}

@keyframes girar {
  0%, 30% { transform: rotate(0deg); }
  60%, 100% { transform: rotate(90deg); }
}

@media (orientation: portrait) and (pointer: coarse) {
  #girar { display: flex; }
}

.aviso { padding: 24px; text-align: center; }

/* ---------- Convite / cadastro do PROJES (formulário por cima do jogo) ---------- */
.projes-fundo {
  position: fixed;
  inset: 0;
  z-index: 20;
  background: rgba(6, 18, 40, 0.88);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  overflow-y: auto;
  padding: 16px;
  -webkit-overflow-scrolling: touch;
}
.projes-caixa {
  margin: auto;
  width: 100%;
  max-width: 560px;
  background: var(--marinho);
  border: 3px solid var(--dourado);
  border-radius: 14px;
  padding: 18px 20px 14px;
  color: #fff;
  text-align: center;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}
.projes-logo { height: 44px; margin-bottom: 4px; }
.projes-caixa h2 { color: var(--dourado-claro); font-size: 22px; margin-bottom: 6px; }
.projes-texto { font-size: 14px; line-height: 1.4; opacity: 0.95; margin-bottom: 12px; }
.projes-grade { display: flex; flex-wrap: wrap; gap: 8px 10px; text-align: left; }
.projes-grade label { flex: 1 1 200px; font-size: 13px; color: var(--dourado-claro); }
.projes-grade label.projes-curto { flex: 0 0 90px; }
.projes-caixa input:not([type="checkbox"]) {
  display: block;
  width: 100%;
  margin-top: 3px;
  padding: 9px 10px;
  font: inherit;
  font-size: 16px;            /* 16px evita o zoom automático do iPhone */
  color: #10223f;
  background: #fff;
  border: 2px solid transparent;
  border-radius: 8px;
}
.projes-caixa input:focus { outline: none; border-color: var(--dourado-claro); }
.projes-responsavel {
  margin-top: 10px;
  padding: 8px 10px 10px;
  border: 1px dashed var(--dourado);
  border-radius: 10px;
  text-align: left;
}
.projes-responsavel legend { font-size: 13px; color: var(--dourado-claro); padding: 0 6px; }
.projes-autorizo {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  margin-top: 12px;
  font-size: 12px;
  line-height: 1.4;
  text-align: left;
  opacity: 0.95;
}
.projes-autorizo input { width: 20px; height: 20px; flex: 0 0 20px; margin-top: 1px; accent-color: var(--dourado); }
.projes-mel { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.projes-erro { min-height: 18px; margin: 8px 0 2px; font-size: 13px; color: #ffb4a8; font-weight: bold; }
.projes-botoes { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 6px; }
.projes-botoes button {
  font: inherit;
  font-weight: bold;
  font-size: 16px;
  padding: 10px 18px;
  border-radius: 10px;
  cursor: pointer;
  border: 2px solid var(--dourado);
}
.projes-enviar { background: var(--dourado); color: var(--marinho-escuro); }
.projes-enviar:disabled { opacity: 0.6; cursor: wait; }
.projes-depois { background: transparent; color: var(--dourado-claro); }
.projes-lema { margin-top: 10px; font-size: 13px; font-style: italic; color: var(--dourado-claro); }

/* Celular deitado: tudo mais compacto */
@media (max-height: 500px) {
  .projes-fundo { padding: 8px; }
  .projes-caixa { padding: 10px 14px 8px; }
  .projes-logo { height: 30px; }
  .projes-caixa h2 { font-size: 18px; margin-bottom: 2px; }
  .projes-texto { font-size: 12px; margin-bottom: 6px; }
  .projes-caixa input:not([type="checkbox"]) { padding: 6px 8px; }
  .projes-lema { display: none; }
}

/* ---------- Certificado e Missão ---------- */
.certificado-caixa { max-width: 520px; }
.certificado-previa {
  display: block;
  width: 100%;
  max-width: 300px;
  height: auto;
  margin: 10px auto 4px;
  border-radius: 8px;
  image-rendering: auto;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.5);
}
.missao-texto {
  font-size: 20px;
  font-weight: bold;
  color: var(--dourado-claro);
  line-height: 1.35;
  margin: 8px 0 12px;
}
.missao-link {
  display: inline-block;
  margin: 2px 0 10px;
  padding: 8px 14px;
  border: 2px solid var(--dourado);
  border-radius: 10px;
  color: var(--dourado-claro);
  font-weight: bold;
  text-decoration: none;
}
@media (max-height: 500px) {
  .certificado-previa { max-width: 150px; }
  .missao-texto { font-size: 17px; }
}

/* Acessibilidade: opções com caixinha */
.acessivel-opcao {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  text-align: left;
  margin: 0 0 10px;
  padding: 8px 10px;
  border: 1px solid rgba(212, 175, 55, 0.45);
  border-radius: 10px;
  font-size: 14px;
  cursor: pointer;
}
.acessivel-opcao input { width: 22px; height: 22px; flex: 0 0 22px; margin-top: 2px; accent-color: var(--dourado); }
.acessivel-opcao small { opacity: 0.85; }

/* Certificado: abas Frente / Para a família */
.cert-abas { display: flex; gap: 6px; justify-content: center; margin-top: 8px; }
.cert-abas button {
  padding: 6px 12px;
  border: 2px solid var(--dourado);
  border-radius: 999px;
  background: transparent;
  color: var(--dourado-claro);
  font-weight: bold;
  cursor: pointer;
}
.certificado-previa[hidden] { display: none; }
.cert-abas button.ativa { background: var(--dourado); color: var(--marinho-escuro); }

/* Ranking (estilo fliperama) */
.ranking-caixa { max-width: 440px; }
.ranking-lista { list-style: none; margin: 10px 0 6px; padding: 0; text-align: left; max-height: 46vh; overflow-y: auto; }
.ranking-lista li {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 6px 10px;
  border-bottom: 1px dashed rgba(212, 175, 55, 0.35);
  font-family: "Courier New", monospace;
  font-weight: bold;
  font-size: 16px;
}
.ranking-pos { width: 34px; text-align: center; color: var(--dourado-claro); }
.ranking-nome { flex: 1; letter-spacing: 2px; }
.ranking-pontos { color: var(--dourado-claro); }
.ranking-voce { background: rgba(212, 175, 55, 0.22); border-radius: 8px; }
.ranking-vazio { justify-content: center; font-family: inherit !important; font-weight: normal !important; opacity: 0.85; }
.ranking-eu { margin: 6px 0 4px; }

/* As janelas ficam dentro de #jogo (que bloqueia gestos para o jogo): aqui a rolagem volta */
.projes-fundo { touch-action: pan-y; }
.projes-fundo input, .projes-fundo button, .projes-fundo a { touch-action: manipulation; }
