:root {
  /* Paleta extraída direto do material oficial do estande Rubeus no FNESP:
     fundo verde-petróleo quase preto, texto branco, e o ciano/mint vibrante
     como cor de destaque (usado no "FNESP" e no botão de CTA do flyer). */
  --bg: #030f0d;
  --bg-soft: #06211c;
  --card: #062821;
  --border: #124a3f;
  --text: #ffffff;
  --text-muted: #a9d2cb;
  --accent: #00e6c6;
  --accent-2: #00b894;
  --accent-fill: #00473a;
  --success: #38d996;
  --radius: 16px;
  --max-width: 1100px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Poppins", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  background:
    linear-gradient(180deg, rgba(3, 15, 13, 0.35) 0%, rgba(3, 15, 13, 0.75) 55%, var(--bg) 100%),
    url("bg.jpg");
  background-size: cover;
  /* O hexágono da imagem fica no canto superior direito do arquivo original.
     "top right" garante que ele continue visível mesmo quando a tela é
     estreita (celular) e o "cover" precisa cortar as laterais da imagem. */
  background-position: top right;
  background-repeat: no-repeat;
  background-attachment: fixed;
  background-color: var(--bg);
  color: var(--text);
  min-height: 100vh;
  position: relative;
}

@media (max-width: 860px) {
  /* background-attachment: fixed can cause jumpy/blurry repaint on mobile
     Safari; scroll is smoother and the cover/position still frame the
     logo hexagon nicely at the top of the page. */
  body { background-attachment: scroll; }
}

mark.mark-accent {
  background: none;
  color: var(--accent);
  font-weight: inherit;
  padding: 0;
}

[hidden] {
  display: none !important;
}

main {
  position: relative;
  z-index: 1;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 48px 24px 60px;
}

.page-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.85fr);
  gap: 56px;
  align-items: start;
}

.logo-big {
  height: 42px;
  width: auto;
  display: block;
  margin-bottom: 32px;
}

.hero-col h1 {
  font-size: 38px;
  font-weight: 800;
  letter-spacing: -0.3px;
  line-height: 1.16;
  margin: 0 0 16px;
}
.hero-col p.hero-sub {
  color: var(--text);
  font-weight: 600;
  font-size: 17px;
  line-height: 1.5;
  margin: 0 0 18px;
  max-width: 480px;
}
.hero-desc {
  color: var(--text-muted);
  font-size: 15px;
  line-height: 1.65;
  margin: 0;
  max-width: 480px;
}

.steps-bar {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 32px;
}
.step {
  display: flex;
  align-items: center;
  gap: 12px;
}
.step-icon {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--accent-fill);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
}
.step-text {
  font-size: 14px;
  color: var(--text-muted);
}
.step-text strong {
  color: var(--text);
  font-weight: 700;
}

.action-col {
  justify-self: stretch;
}

.selfie-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  max-width: 420px;
  margin: 0 auto;
}

.camera-box {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  min-height: 200px;
  border-radius: 14px;
  border: 2px dashed var(--border);
  background: var(--bg-soft);
  overflow: hidden;
  cursor: pointer;
  padding: 0;
  margin: 0;
  transition: border-color .15s ease;
}
.camera-box:hover,
.camera-box:focus-visible {
  border-color: var(--accent);
}
.camera-box:disabled {
  cursor: default;
}

.camera-idle {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 16px;
  text-align: center;
}
.camera-icon-circle {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--accent-fill);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
}
.camera-label {
  font-weight: 600;
  font-size: 15px;
  color: var(--text);
}

.selfie-preview {
  position: absolute;
  inset: 0;
}
.selfie-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.camera-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: var(--bg-soft);
  transform: scaleX(-1); /* espelha a prévia, como um espelho de verdade */
}

.camera-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  margin-top: 14px;
  text-align: center;
}
.camera-actions .btn { margin: 0; }
.camera-actions .btn + .btn { margin-top: 8px; }

.btn {
  display: inline-block;
  border: none;
  border-radius: 999px;
  padding: 12px 22px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: opacity .15s ease, transform .1s ease;
  font-family: inherit;
}
.btn:active { transform: scale(0.98); }
.btn-accent {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #032019;
  font-weight: 700;
}
.btn-accent:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}
.btn-block {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  margin-top: 18px;
}
.btn-arrow {
  font-size: 18px;
  line-height: 1;
  transition: transform .15s ease;
}
.btn-block:not(:disabled):hover .btn-arrow {
  transform: translateX(3px);
}
.btn-small { padding: 8px 14px; font-size: 13px; }
.btn-link {
  background: none;
  color: var(--text-muted);
  text-decoration: underline;
  padding: 6px;
  font-size: 13px;
}

.hint { color: var(--text-muted); font-size: 12px; margin: 10px 0 0; }

.trust-box {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  text-align: left;
  margin-top: 20px;
  padding: 12px 14px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 12px;
  font-size: 12.5px;
  color: var(--text-muted);
  line-height: 1.45;
}
.trust-box p { margin: 0; }
.trust-icon {
  flex-shrink: 0;
  color: var(--accent);
  margin-top: 1px;
}

.status {
  text-align: center;
  padding: 20px;
  color: var(--text-muted);
  font-size: 14px;
}
.status.error { color: var(--accent); }
.spinner {
  width: 28px; height: 28px;
  border-radius: 50%;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
  margin: 0 auto 10px;
}
@keyframes spin { to { transform: rotate(360deg); } }

.results {
  margin-top: 48px;
}

.results-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.results-header h2 { font-size: 18px; margin: 0; }
.results-toolbar { display: flex; gap: 8px; }

.fallback-note {
  background: var(--accent-fill);
  border: 1px solid var(--accent);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 13px;
  color: var(--text);
  margin-bottom: 14px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 10px;
}
.grid-item {
  position: relative;
  aspect-ratio: 1 / 1;
  border-radius: 10px;
  overflow: hidden;
  background: var(--bg-soft);
  cursor: pointer;
}
.grid-item img {
  width: 100%; height: 100%; object-fit: cover;
  display: block;
}
.grid-item .check {
  position: absolute;
  top: 6px; right: 6px;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: rgba(3,15,13,0.7);
  border: 2px solid white;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px;
}
.grid-item.selected .check {
  background: var(--success);
  border-color: var(--success);
}
.grid-item .score-badge {
  position: absolute;
  bottom: 4px; left: 4px;
  background: rgba(3,15,13,0.75);
  color: var(--text);
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 999px;
}

.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(2,8,7,0.92);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}
.lightbox img {
  max-width: 100%;
  max-height: 75vh;
  border-radius: 10px;
  object-fit: contain;
}
.lightbox-close {
  position: absolute;
  top: 16px; right: 16px;
  width: 44px; height: 44px;
  border-radius: 50%;
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.3);
  color: white;
  font-size: 26px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 5;
}
.lightbox-close:hover { background: rgba(255,255,255,0.22); }
.lightbox-download { margin-top: 18px; }

footer {
  position: relative;
  z-index: 1;
  text-align: center;
  color: var(--text-muted);
  font-size: 12px;
  padding: 20px;
}

@media (min-width: 560px) {
  .grid { grid-template-columns: repeat(4, 1fr); }
}

@media (max-width: 860px) {
  main { padding: 32px 18px 50px; }
  .page-grid {
    grid-template-columns: 1fr;
    gap: 36px;
  }
  .hero-col h1 { font-size: 30px; }
  .selfie-card { max-width: 100%; }
  .action-col { justify-self: stretch; }
}
