/* ============ Design tokens ============ */
:root {
  --color-primary: #28A758;
  --color-primary-dark: #1F8A46;
  --color-primary-light: #DDF6E6;
  --color-secondary: #1A318C;
  --color-secondary-light: #E6F2FF;
  --color-accent: #F4C345;
  --color-accent-ink: #1A318C;
  --color-background: #F5F8FF;
  --color-surface: #FFFFFF;
  --color-foreground: #0B1D33;
  --color-muted: #E6F2FF;
  --color-muted-foreground: #55637A;
  --color-border: #E1E7F2;
  --color-destructive: #DC2626;
  --color-ring: #28A758;

  --radius-lg: 24px;
  --radius-md: 16px;
  --radius-sm: 12px;
  --radius-pill: 999px;

  --shadow-card: 0 8px 24px rgba(20, 30, 24, 0.08);
  --shadow-float: 0 16px 40px rgba(20, 30, 24, 0.16);

  --ease-standard: cubic-bezier(0.32, 0.72, 0, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --dur-fast: 150ms;
  --dur-base: 220ms;
  --dur-slow: 320ms;

  --font-sans: "Mona Sans Variable", "Mona Sans", -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Segoe UI", Roboto, sans-serif;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

@media (prefers-color-scheme: dark) {
  :root {
    --color-primary: #3FCB7A;
    --color-primary-dark: #28A758;
    --color-primary-light: #0E3A22;
    --color-secondary: #60BBED;
    --color-secondary-light: #14243F;
    --color-accent: #F4C345;
    --color-accent-ink: #041B3D;
    --color-background: #041B3D;
    --color-surface: #0B2A57;
    --color-foreground: #F3F7FF;
    --color-muted: #102E56;
    --color-muted-foreground: #9DB1D1;
    --color-border: #1C3C68;
    --shadow-card: 0 8px 24px rgba(0, 4, 16, 0.4);
    --shadow-float: 0 16px 40px rgba(0, 4, 16, 0.55);
  }
}
:root[data-theme="dark"] {
  --color-primary: #3FCB7A;
  --color-primary-dark: #28A758;
  --color-primary-light: #0E3A22;
  --color-secondary: #60BBED;
  --color-secondary-light: #14243F;
  --color-accent: #F4C345;
  --color-accent-ink: #041B3D;
  --color-background: #041B3D;
  --color-surface: #0B2A57;
  --color-foreground: #F3F7FF;
  --color-muted: #102E56;
  --color-muted-foreground: #9DB1D1;
  --color-border: #1C3C68;
  --shadow-card: 0 8px 24px rgba(0, 4, 16, 0.4);
  --shadow-float: 0 16px 40px rgba(0, 4, 16, 0.55);
}
:root[data-theme="light"] {
  --color-primary: #28A758;
  --color-primary-dark: #1F8A46;
  --color-primary-light: #DDF6E6;
  --color-secondary: #1A318C;
  --color-secondary-light: #E6F2FF;
  --color-accent: #F4C345;
  --color-accent-ink: #1A318C;
  --color-background: #F5F8FF;
  --color-surface: #FFFFFF;
  --color-foreground: #0B1D33;
  --color-muted: #E6F2FF;
  --color-muted-foreground: #55637A;
  --color-border: #E1E7F2;
  --shadow-card: 0 8px 24px rgba(20, 30, 24, 0.08);
  --shadow-float: 0 16px 40px rgba(20, 30, 24, 0.16);
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

/* ============ Animated background ============ */
.bg-animated {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  background: var(--color-background);
}
.bg-blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(70px);
  opacity: 0.4;
  will-change: transform;
}
.bg-blob--green {
  width: 46vh; height: 46vh;
  top: -14vh; left: -12vh;
  background: var(--color-primary);
  animation: blobFloatA 17s ease-in-out infinite alternate;
}
.bg-blob--gold {
  width: 38vh; height: 38vh;
  bottom: -12vh; right: -10vh;
  background: var(--color-accent);
  animation: blobFloatB 21s ease-in-out infinite alternate;
}
.bg-blob--blue {
  width: 56vh; height: 56vh;
  top: 30vh; right: -18vh;
  background: var(--color-secondary);
  opacity: 0.5;
  animation: blobFloatC 19s ease-in-out infinite alternate;
}
.bg-blob--green2 {
  width: 30vh; height: 30vh;
  bottom: 8vh; left: -8vh;
  background: var(--color-primary);
  opacity: 0.28;
  animation: blobFloatA 23s ease-in-out infinite alternate-reverse;
}
.bg-blob--white {
  width: 32vh; height: 32vh;
  top: 10vh; right: 18vh;
  background: #FFFFFF;
  opacity: 0.16;
  animation: blobFloatB 15s ease-in-out infinite alternate-reverse;
}

@keyframes blobFloatA {
  from { transform: translate(0, 0) scale(1); }
  to   { transform: translate(6vh, 8vh) scale(1.18); }
}
@keyframes blobFloatB {
  from { transform: translate(0, 0) scale(1); }
  to   { transform: translate(-6vh, -7vh) scale(1.12); }
}
@keyframes blobFloatC {
  from { transform: translate(0, 0) scale(1); }
  to   { transform: translate(-7vh, 6vh) scale(0.9); }
}

@media (prefers-color-scheme: dark) {
  .bg-blob { opacity: 0.5; filter: blur(80px); }
  .bg-blob--green2 { opacity: 0.36; }
  .bg-blob--white { opacity: 0.1; }
}
:root[data-theme="dark"] .bg-blob { opacity: 0.5; filter: blur(80px); }
:root[data-theme="dark"] .bg-blob--green2 { opacity: 0.36; }
:root[data-theme="dark"] .bg-blob--white { opacity: 0.1; }

@media (prefers-reduced-motion: reduce) {
  .bg-blob { animation: none !important; }
}

/* ============ Reset / base ============ */
* { box-sizing: border-box; }
html, body {
  height: 100%;
  margin: 0;
  background: var(--color-background);
  overflow: hidden;
}
body {
  background: transparent;
  color: var(--color-foreground);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}
button, input {
  font-family: inherit;
  color: inherit;
}
button {
  cursor: pointer;
  touch-action: manipulation;
}
:focus-visible {
  outline: 2px solid var(--color-ring);
  outline-offset: 2px;
}
img { max-width: 100%; display: block; }

.app {
  height: 100dvh;
  display: flex;
  flex-direction: column;
  max-width: 560px;
  margin: 0 auto;
  position: relative;
  overflow: hidden;
}

/* ============ Top bar ============ */
.topbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: calc(var(--safe-top) + 6px) 16px 6px;
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in srgb, var(--color-background) 88%, transparent);
  backdrop-filter: blur(14px) saturate(160%);
  -webkit-backdrop-filter: blur(14px) saturate(160%);
}
.icon-btn {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-pill);
  border: none;
  background: var(--color-surface);
  box-shadow: var(--shadow-card);
  color: var(--color-foreground);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform var(--dur-fast) var(--ease-spring), opacity var(--dur-fast);
}
.icon-btn:active { transform: scale(0.92); }
#backBtn {
  width: 36px;
  height: 36px;
}
#backBtn svg { width: 18px; height: 18px; }

.topbar-logo {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  min-width: 0;
}
.topbar-logo img {
  height: 26px;
  width: auto;
  max-width: 140px;
  object-fit: contain;
}
.topbar-steps {
  display: flex;
  gap: 6px;
  margin: 0 0 0 auto;
  flex: 0 0 auto;
}
.step-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-border);
  transition: background var(--dur-base) var(--ease-standard), width var(--dur-base) var(--ease-standard);
}
.step-dot.is-active {
  background: var(--color-primary);
  width: 20px;
  border-radius: var(--radius-pill);
}
.step-dot.is-done { background: var(--color-primary); }
.topbar-steps[hidden], .icon-btn[hidden], .topbar[hidden] { display: none; }

/* ============ Screens ============ */
.screens {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}
.screen {
  display: none;
  flex-direction: column;
  padding: 2px 20px 8px;
  animation: screenIn var(--dur-slow) var(--ease-standard);
}
.screen.active { display: flex; flex: 1; min-height: 0; }
.screen[data-screen="landing"] { padding-top: 14px; padding-bottom: 16px; }
@keyframes screenIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.screen-head { margin: 12px 0 20px; }
.screen-head--tight { margin-bottom: 12px; }
.screen[data-screen="name"] .screen-head,
.screen[data-screen="results"] .screen-head { text-align: center; }
.screen-title {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.01em;
  margin: 0 0 6px;
}
.screen-sub {
  margin: 0;
  color: var(--color-muted-foreground);
  font-size: 15px;
}
.text-accent {
  background: linear-gradient(90deg, var(--color-primary), var(--color-secondary), var(--color-accent), var(--color-primary));
  background-size: 300% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: textGradient 7s linear infinite;
}
@keyframes textGradient {
  0% { background-position: 0% 50%; }
  100% { background-position: 300% 50%; }
}

/* ============ Landing ============ */
.landing-head { text-align: center; margin: 10px 0 24px; }
.badge-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 18px;
}
.badge-number {
  min-width: 56px;
  height: 56px;
  margin: 0;
  padding: 0 12px;
  border-radius: 18px;
  background: linear-gradient(135deg, var(--color-accent), #FFF3B0);
  color: var(--color-accent-ink);
  font-weight: 800;
  font-size: 20px;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-card);
  position: relative;
  animation: badgePulse 3.2s ease-in-out infinite;
}
.candidate-tag {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--color-surface);
  padding: 5px 14px 5px 5px;
  border-radius: var(--radius-pill);
  box-shadow: var(--shadow-card);
}
.candidate-tag-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--color-accent);
}
.candidate-tag-handle {
  font-size: 13px;
  font-weight: 700;
  color: var(--color-secondary);
}
@keyframes badgePulse {
  0%, 100% { box-shadow: var(--shadow-card), 0 0 0 0 rgba(244, 195, 69, 0.45); }
  50% { box-shadow: var(--shadow-card), 0 0 0 10px rgba(244, 195, 69, 0); }
}
.landing-title {
  line-height: 1.18;
  letter-spacing: -0.01em;
  margin: 0 0 16px;
}
.landing-title-eyebrow {
  display: block;
  font-size: 16px;
  font-weight: 600;
  color: var(--color-muted-foreground);
  margin-bottom: 6px;
}
.landing-title-name {
  display: block;
  font-size: 34px;
  font-weight: 800;
}
.landing-sub {
  color: var(--color-muted-foreground);
  font-size: 15px;
  line-height: 1.5;
  margin: 0 auto;
  max-width: 40ch;
}

.landing-preview-solo {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  flex: 1;
  min-height: 0;
  justify-content: center;
  width: 100%;
}
.preview-stack {
  position: relative;
  width: 100%;
  max-width: 195px;
  aspect-ratio: 630 / 870;
}
.preview-card {
  position: absolute;
  inset: 0;
  border-radius: 20px;
  background: transparent;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform .85s cubic-bezier(.22, .8, .28, 1), opacity .85s ease, box-shadow .85s ease;
  will-change: transform, opacity;
}
.preview-front-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
}
/* posição no carrossel: frente vem de trás pra frente, a de trás recua */
.preview-card.pos-front {
  transform: translate(0, 0) scale(1) rotate(0deg);
  opacity: 1;
  z-index: 3;
  box-shadow: var(--shadow-float);
}
.preview-card.pos-mid {
  transform: translate(15%, 4%) scale(.86) rotate(9deg);
  opacity: .7;
  z-index: 2;
  box-shadow: 0 14px 30px rgba(1, 7, 43, .3);
}
.preview-card.pos-back {
  transform: translate(-16%, 6%) scale(.74) rotate(-11deg);
  opacity: .45;
  z-index: 1;
  box-shadow: none;
}
.landing-col-caption {
  margin: 0;
  font-size: 12px;
  font-weight: 600;
  color: var(--color-muted-foreground);
  text-align: center;
}
.landing-site-tag {
  margin: 22px 0 4px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: var(--color-secondary);
  text-align: center;
}

@media (max-width: 359px) {
  .landing-title { font-size: 22px; }
  .landing-sub { font-size: 13.5px; }
}

/* ============ Upload ============ */
.upload-zone {
  position: relative;
  aspect-ratio: 1 / 1;
  height: min(34vh, 320px);
  width: auto;
  max-width: 100%;
  margin: 0 auto;
  flex-shrink: 1;
  border-radius: var(--radius-lg);
  border: 2px dashed var(--color-border);
  background: var(--color-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  transition: border-color var(--dur-base) var(--ease-standard);
}
.upload-zone.has-image { border-style: solid; border-color: var(--color-primary); }
.upload-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  color: var(--color-muted-foreground);
  padding: 24px;
  text-align: center;
}
.upload-icon {
  width: 64px; height: 64px;
  border-radius: 50%;
  background: var(--color-surface);
  box-shadow: var(--shadow-card);
  display: flex; align-items: center; justify-content: center;
  color: var(--color-primary);
}
.upload-hint { margin: 0; font-size: 14px; font-weight: 500; }
.upload-empty[hidden] { display: none; }
.upload-preview-img {
  width: 100%; height: 100%;
  object-fit: cover;
}
.upload-preview-img[hidden] { display: none; }

.upload-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 16px;
}

/* ============ Name step ============ */
.name-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  margin-top: 8px;
}
.name-photo-preview {
  width: 128px; height: 128px;
  border-radius: 32px;
  overflow: hidden;
  box-shadow: var(--shadow-card);
  border: 3px solid var(--color-surface);
  outline: 3px solid var(--color-primary-light);
}
.name-photo-preview img { width: 100%; height: 100%; object-fit: cover; }

.field { width: 100%; }
.field-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--color-muted-foreground);
  margin-bottom: 6px;
}
.field-input {
  width: 100%;
  min-height: 52px;
  padding: 0 16px;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--color-border);
  background: var(--color-surface);
  font-size: 17px;
  font-weight: 500;
  transition: border-color var(--dur-fast) var(--ease-standard), box-shadow var(--dur-fast);
}
.field-input:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 4px var(--color-primary-light);
  outline: none;
}

/* ============ Processing ============ */
.processing-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
}
.spinner {
  width: 44px; height: 44px;
  border-radius: 50%;
  border: 4px solid var(--color-primary-light);
  border-top-color: var(--color-primary);
  animation: spin 900ms linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.processing-text {
  font-weight: 600;
  color: var(--color-muted-foreground);
}

/* ============ Results / carousel ============ */
.results-tabs {
  display: flex;
  gap: 8px;
  margin: 0 0 14px;
  background: var(--color-muted);
  border-radius: var(--radius-pill);
  padding: 4px;
}
.results-tab {
  flex: 1;
  border: none;
  background: none;
  padding: 10px 8px;
  border-radius: var(--radius-pill);
  font-size: 13px;
  font-weight: 700;
  color: var(--color-muted-foreground);
  transition: background var(--dur-fast) var(--ease-standard), color var(--dur-fast) var(--ease-standard);
}
.results-tab.is-active {
  background: var(--jg-yellow, #F4C345);
  color: var(--jg-blue, var(--color-foreground));
  box-shadow: var(--shadow-card);
}

.carousel-wrap { position: relative; flex: 1; min-height: 0; display: flex; }
.carousel-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: rgba(10, 16, 13, 0.5);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(6px);
  transition: transform var(--dur-fast) var(--ease-spring), opacity var(--dur-fast);
  z-index: 2;
}
.carousel-arrow:active { transform: translateY(-50%) scale(0.9); }
.carousel-arrow:disabled { opacity: 0.35; }
.carousel-arrow--prev { left: 12px; }
.carousel-arrow--next { right: 12px; }
.carousel {
  display: flex;
  flex: 1;
  min-height: 0;
  gap: 16px;
  overflow-x: auto;
  scroll-behavior: smooth;
  scroll-snap-type: x mandatory;
  padding: 4px 4px 8px;
  margin: 0 -4px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.carousel::-webkit-scrollbar { display: none; }
.carousel-slide {
  flex: 0 0 100%;
  scroll-snap-align: center;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  background: var(--color-muted);
}
.carousel-slide img, .carousel-slide canvas {
  width: 100%; height: 100%;
  object-fit: contain;
  display: block;
}
.carousel-dots {
  display: flex;
  justify-content: center;
  gap: 7px;
  margin: 12px 0 8px;
}
.carousel-dots .dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--color-border);
  transition: all var(--dur-base) var(--ease-standard);
}
.carousel-dots .dot.is-active {
  background: var(--color-primary);
  width: 18px;
  border-radius: var(--radius-pill);
}

.results-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 8px;
}
.link-btn {
  border: none;
  background: none;
  color: var(--color-muted-foreground);
  font-weight: 600;
  font-size: 14px;
  margin: 18px auto 0;
  padding: 10px;
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ============ Buttons ============ */
.btn {
  min-height: 52px;
  border-radius: var(--radius-md);
  border: none;
  font-weight: 700;
  font-size: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 20px;
  transition: transform var(--dur-fast) var(--ease-spring), opacity var(--dur-fast), background var(--dur-fast);
}
.btn:active { transform: scale(0.97); }
.btn-primary {
  background: var(--color-primary);
  color: #fff;
}
.btn-primary:disabled {
  opacity: 0.45;
  transform: none;
}
.btn-secondary {
  background: var(--color-surface);
  color: var(--color-foreground);
  box-shadow: var(--shadow-card);
}
.btn-ghost {
  background: none;
  color: var(--color-muted-foreground);
}
.btn-block { width: 100%; }

/* ============ CTA bar ============ */
.ctabar {
  position: sticky;
  bottom: 0;
  padding: 12px 24px calc(var(--safe-bottom) + 16px);
  background: linear-gradient(to top, var(--color-background) 60%, transparent);
}
.ctabar[hidden] { display: none; }

/* ============ Live camera overlay ============ */
.camera-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn var(--dur-base) var(--ease-standard);
}
.camera-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1);
}
.camera-close, .camera-flip {
  position: absolute;
  top: calc(var(--safe-top) + 16px);
  background: rgba(0,0,0,0.45);
  color: #fff;
  box-shadow: none;
}
.camera-close { left: 16px; }
.camera-flip { right: 16px; }
.camera-shutter {
  position: absolute;
  bottom: calc(var(--safe-bottom) + 32px);
  left: 50%;
  transform: translateX(-50%);
  width: 74px;
  height: 74px;
  border-radius: 50%;
  background: #fff;
  border: 4px solid rgba(255,255,255,0.5);
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
  transition: transform var(--dur-fast) var(--ease-spring);
}
.camera-shutter:active { transform: translateX(-50%) scale(0.9); }
.camera-hint {
  position: absolute;
  top: calc(var(--safe-top) + 24px);
  left: 50%;
  transform: translateX(-50%);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  background: rgba(0,0,0,0.4);
  padding: 6px 14px;
  border-radius: var(--radius-pill);
}
.camera-overlay[hidden] { display: none; }

.camera-grid {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.camera-grid span {
  position: absolute;
  background: rgba(255,255,255,0.35);
}
.camera-grid span:nth-child(1) { left: 33.333%; top: 0; bottom: 0; width: 1px; }
.camera-grid span:nth-child(2) { left: 66.666%; top: 0; bottom: 0; width: 1px; }
.camera-grid span:nth-child(3) { top: 33.333%; left: 0; right: 0; height: 1px; }
.camera-grid::before,
.camera-grid::after { content: ""; position: absolute; left: 0; right: 0; height: 1px; background: rgba(255,255,255,0.35); }
.camera-grid::before { top: 66.666%; }
.camera-grid::after { top: 33.333%; }

/* ============ Inline photo edit (pan/zoom inside frame) ============ */
.upload-zone.has-image { touch-action: none; cursor: grab; }
.upload-zone.has-image:active { cursor: grabbing; }
.upload-zone.has-image .upload-preview-img {
  position: absolute;
  top: 0;
  left: 0;
  width: auto;
  height: auto;
  max-width: none;
  object-fit: none;
  transform-origin: top left;
  user-select: none;
  -webkit-user-drag: none;
}
.upload-edit-grid {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.upload-edit-grid[hidden] { display: none; }
.upload-edit-grid span {
  position: absolute;
  background: rgba(255,255,255,0.45);
}
.upload-edit-grid span:nth-child(1) { left: 33.333%; top: 0; bottom: 0; width: 1px; }
.upload-edit-grid span:nth-child(2) { left: 66.666%; top: 0; bottom: 0; width: 1px; }
.upload-edit-grid span:nth-child(3) { top: 33.333%; left: 0; right: 0; height: 1px; }
.upload-edit-grid::before,
.upload-edit-grid::after { content: ""; position: absolute; left: 0; right: 0; height: 1px; background: rgba(255,255,255,0.45); }
.upload-edit-grid::before { top: 66.666%; }
.upload-edit-grid::after { top: 33.333%; }

.upload-zoom-control {
  width: 100%;
  max-width: 320px;
  margin: 12px auto 0;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--color-muted-foreground);
}
.upload-zoom-control[hidden] { display: none; }
.upload-zoom-icon { flex: 0 0 auto; }
.upload-zoom-icon--lg { color: var(--color-foreground); }
.upload-zoom-range {
  flex: 1;
  accent-color: var(--color-primary);
}

/* ============ Share bottom sheet ============ */
.sheet-scrim {
  position: fixed;
  inset: 0;
  background: rgba(6, 10, 8, 0.5);
  z-index: 40;
  animation: fadeIn var(--dur-base) var(--ease-standard);
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.sheet {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: 100%;
  max-width: 560px;
  background: var(--color-surface);
  border-radius: 28px 28px 0 0;
  box-shadow: var(--shadow-float);
  padding: 10px 20px calc(var(--safe-bottom) + 20px);
  z-index: 50;
  animation: sheetUp var(--dur-slow) var(--ease-standard);
}
@keyframes sheetUp {
  from { transform: translateX(-50%) translateY(100%); }
  to { transform: translateX(-50%) translateY(0); }
}
.sheet-handle {
  width: 40px; height: 4px;
  background: var(--color-border);
  border-radius: 2px;
  margin: 6px auto 14px;
}
.sheet-title {
  font-size: 18px;
  font-weight: 800;
  margin: 0 0 4px;
  text-align: center;
}
.sheet-sub {
  margin: 0 0 16px;
  text-align: center;
  color: var(--color-muted-foreground);
  font-size: 14px;
}
.sheet-options {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}
.sheet-option {
  border: none;
  background: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 10px 4px;
  border-radius: var(--radius-md);
  font-size: 12px;
  font-weight: 600;
  color: var(--color-foreground);
  transition: background var(--dur-fast), transform var(--dur-fast) var(--ease-spring);
}
.sheet-option:active { transform: scale(0.94); background: var(--color-muted); }
.sheet-option-icon {
  width: 48px; height: 48px;
  border-radius: 16px;
  background: var(--color-muted);
  display: flex; align-items: center; justify-content: center;
  color: var(--color-primary);
}

/* ============ Responsive ============ */
@media (min-width: 480px) {
  .landing-title { font-size: 34px; }
}

/* ======================================================================
   JOÃO GALASSI 1020 — BRAND POLISH
   Visual-only overrides. The original DOM structure and app.js behavior
   remain untouched to preserve camera, upload, canvas and sharing flows.
   ====================================================================== */

:root,
:root[data-theme="light"],
:root[data-theme="dark"] {
  --jg-blue: #1A318C;
  --jg-blue-deep: #10236F;
  --jg-sky: #60BBED;
  --jg-green: #28A758;
  --jg-green-dark: #1F8A46;
  --jg-yellow: #F4C345;
  --jg-ice: #E6F2FF;
  --jg-white: #FDFDFF;
  --jg-ink: #10213A;

  --color-primary: var(--jg-green);
  --color-primary-dark: var(--jg-green-dark);
  --color-primary-light: #DDF5E5;
  --color-secondary: var(--jg-blue);
  --color-secondary-light: var(--jg-ice);
  --color-accent: var(--jg-yellow);
  --color-accent-ink: var(--jg-blue);
  --color-background: #F3F8FF;
  --color-surface: #FFFFFF;
  --color-foreground: var(--jg-ink);
  --color-muted: #EDF6FF;
  --color-muted-foreground: #5E6C82;
  --color-border: #D7E4F4;
  --color-ring: var(--jg-sky);

  --radius-lg: 28px;
  --radius-md: 18px;
  --radius-sm: 12px;
  --shadow-card: 0 12px 30px rgba(26, 49, 140, .10);
  --shadow-float: 0 24px 54px rgba(10, 31, 99, .22);
}

html,
body {
  background: var(--jg-blue-deep);
}

body {
  color: var(--color-foreground);
}

.bg-animated {
  background:
    radial-gradient(circle at 8% 8%, rgba(40,167,88,.28), transparent 26%),
    radial-gradient(circle at 90% 12%, rgba(244,195,69,.26), transparent 24%),
    radial-gradient(circle at 92% 86%, rgba(96,187,237,.24), transparent 30%),
    linear-gradient(145deg, #10236F 0%, #1A318C 55%, #122B78 100%);
}
.bg-blob { opacity: .16 !important; filter: blur(92px) !important; }
.bg-blob--white { opacity: .07 !important; }

.app {
  background: #F6FAFF;
  box-shadow: 0 0 0 1px rgba(255,255,255,.06), 0 28px 80px rgba(0,0,0,.22);
}

.topbar {
  min-height: 58px;
  padding-top: calc(var(--safe-top) + 7px);
  background: var(--jg-blue, #1A318C);
  border-bottom: 1px solid rgba(0,0,0,.15);
  backdrop-filter: blur(18px) saturate(145%);
  -webkit-backdrop-filter: blur(18px) saturate(145%);
}

.topbar::after {
  content: "";
  position: absolute;
  left: 20px;
  right: 20px;
  bottom: -1px;
  height: 3px;
  border-radius: 99px 99px 0 0;
  background: linear-gradient(90deg,
    var(--jg-yellow) 0 20%,
    var(--jg-blue) 20% 40%,
    var(--jg-sky) 40% 60%,
    var(--jg-green) 60% 80%,
    var(--jg-yellow) 80% 100%);
  opacity: .9;
}

.icon-btn {
  background: #fff;
  color: var(--jg-blue);
  border: 1px solid rgba(26,49,140,.10);
  box-shadow: 0 7px 18px rgba(26,49,140,.10);
}
.step-dot { background: rgba(255,255,255,.35); }
.step-dot.is-active {
  background: var(--jg-yellow);
  box-shadow: 0 0 0 4px rgba(244,195,69,.16);
}
.step-dot.is-done { background: var(--jg-green); }

.screens {
  background: #F6FAFF;
}

.screen {
  padding-left: 22px;
  padding-right: 22px;
}

.screen:not([data-screen="landing"])::before {
  content: "";
  display: block;
  width: 58px;
  height: 7px;
  margin: 10px 0 14px;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--jg-green) 0 33%, var(--jg-yellow) 33% 66%, var(--jg-sky) 66% 100%);
}

.screen-title {
  color: var(--jg-blue);
  font-size: 29px;
  line-height: 1.04;
  letter-spacing: -.035em;
  font-weight: 900;
}
.screen-sub {
  color: #64728A;
  line-height: 1.45;
}

/* ---------- Landing: mirrors campaign's strong navy + logo language ---------- */
.screen[data-screen="landing"] {
  position: relative;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 8px 24px 14px;
  background:
    radial-gradient(circle at 88% 12%, rgba(244,195,69,.17), transparent 28%),
    radial-gradient(circle at 0% 65%, rgba(40,167,88,.17), transparent 31%),
    linear-gradient(156deg, #1A318C 0%, #162C7D 58%, #10236F 100%);
  color: #fff;
  overflow: hidden;
}
.screen[data-screen="landing"]::before {
  content: "";
  position: absolute;
  width: 290px;
  height: 290px;
  right: -170px;
  top: 105px;
  border: 34px solid rgba(96,187,237,.08);
  border-radius: 50%;
  pointer-events: none;
}
.screen[data-screen="landing"]::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 7px;
  background: linear-gradient(90deg,
    var(--jg-yellow) 0 14.28%,
    var(--jg-blue) 14.28% 28.56%,
    var(--jg-sky) 28.56% 42.84%,
    var(--jg-green) 42.84% 57.12%,
    var(--jg-yellow) 57.12% 71.4%,
    var(--jg-blue) 71.4% 85.68%,
    var(--jg-green) 85.68% 100%);
}

.screen[data-screen="landing"] .landing-head,
.screen[data-screen="landing"] .landing-preview-solo,
.screen[data-screen="landing"] .landing-site-tag {
  position: relative;
  z-index: 1;
}

.landing-head {
  width: 100%;
  text-align: center;
  margin: 0;
}

.badge-row {
  justify-content: center;
  width: 100%;
  margin: 0 0 14px;
}
.badge-row::before {
  content: "";
  display: block;
  width: min(100%, 300px);
  height: 66px;
  margin: 0 auto;
  background: url('assets/logo-joao-galassi-com-numero.svg') center center / contain no-repeat;
}
.badge-number,
.candidate-tag {
  display: none;
}

.text-accent {
  background: none;
  color: inherit;
  animation: none;
}

.landing-title {
  margin-bottom: 10px;
  line-height: .99;
  letter-spacing: -.045em;
}
.landing-title-eyebrow {
  display: inline;
  font-size: clamp(18px, 5.1vw, 24px);
  line-height: 1.12;
  font-weight: 900;
  color: #fff;
  text-transform: uppercase;
  letter-spacing: -.035em;
}
.landing-title-eyebrow::after,
.landing-divider {
  content: "";
  display: block;
  width: 39px;
  height: 3px;
  margin: 5px auto 4px;
  border-radius: 99px;
  background: var(--jg-green);
  box-shadow: 42px 0 0 var(--jg-yellow), 84px 0 0 var(--jg-sky);
}
.landing-divider {
  margin-left: calc(50% - 61.5px);
}
.landing-title-name {
  display: block;
  max-width: 430px;
  font-size: clamp(30px, 8.7vw, 43px);
  line-height: .96;
  font-weight: 900;
  color: var(--jg-sky);
  letter-spacing: -.055em;
}
.landing-sub {
  max-width: 46ch;
  margin: 14px auto 0;
  color: rgba(255,255,255,.82);
  font-size: 13.5px;
  line-height: 1.42;
  font-weight: 520;
}

.landing-eyebrow-text {
  margin: 0 0 6px;
  color: var(--jg-yellow);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .02em;
}

.landing-social-proof {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 40px auto 6px;
  padding: 6px 14px;
  border-radius: 99px;
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.18);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
}

.landing-preview-solo {
  flex: 0 1 auto;
  gap: 8px;
  justify-content: center;
}
.preview-stack {
  max-width: 172px;
}
.preview-card {
  border-radius: 18px;
}
.preview-card.pos-front {
  box-shadow: 0 22px 44px rgba(1,7,43,.38);
}
.landing-col-caption {
  color: rgba(255,255,255,.68);
  font-weight: 650;
}
.landing-site-tag {
  color: var(--jg-yellow);
  margin: 0;
  font-size: 10px;
  letter-spacing: .14em;
}

/* ---------- Upload ---------- */
.upload-zone {
  border: 2px dashed rgba(26,49,140,.26);
  background:
    linear-gradient(135deg, rgba(96,187,237,.13), rgba(230,242,255,.86)),
    #fff;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.9), 0 12px 28px rgba(26,49,140,.08);
}
.upload-zone.has-image {
  border-color: var(--jg-green);
  box-shadow: 0 0 0 4px rgba(40,167,88,.10), 0 16px 34px rgba(26,49,140,.12);
}
.upload-icon {
  width: 68px;
  height: 68px;
  color: var(--jg-blue);
  background: #fff;
  border: 1px solid rgba(26,49,140,.08);
  box-shadow: 0 12px 24px rgba(26,49,140,.12);
}
.upload-icon::after {
  content: "";
  position: absolute;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--jg-yellow);
  transform: translate(25px,-23px);
  box-shadow: -46px 45px 0 var(--jg-green), 5px 46px 0 var(--jg-sky);
}
.upload-hint {
  color: var(--jg-blue);
  font-weight: 750;
}

/* ---------- Form / name ---------- */
.name-card {
  margin-top: 4px;
  padding: 20px;
  background: #fff;
  border: 1px solid rgba(26,49,140,.08);
  border-radius: 26px;
  box-shadow: var(--shadow-card);
}
.name-photo-preview {
  border-radius: 26px;
  border: 4px solid #fff;
  outline: 4px solid rgba(96,187,237,.28);
  box-shadow: 0 12px 30px rgba(26,49,140,.18);
}
.field-label {
  color: var(--jg-blue);
  font-weight: 800;
}
.field-input {
  border: 1.5px solid #CBDCED;
  background: #F8FBFF;
  font-weight: 650;
}
.field-input:focus {
  border-color: var(--jg-sky);
  box-shadow: 0 0 0 4px rgba(96,187,237,.17);
  background: #fff;
}

/* ---------- Processing ---------- */
.spinner {
  border-color: #DCE9F7;
  border-top-color: var(--jg-green);
  box-shadow: 0 0 0 6px rgba(40,167,88,.06);
}
.processing-text {
  color: var(--jg-blue);
  font-weight: 780;
}

/* ---------- Results ---------- */
.carousel-slide {
  border-radius: 24px;
  border: 4px solid #fff;
  background: #fff;
  box-shadow: 0 18px 40px rgba(26,49,140,.16);
}
.carousel-arrow {
  background: rgba(26,49,140,.88);
  border: 2px solid rgba(255,255,255,.42);
  box-shadow: 0 8px 22px rgba(5,18,64,.24);
}
.carousel-dots .dot { background: #C7D8EA; }
.carousel-dots .dot.is-active { background: var(--jg-green); }
.link-btn {
  color: var(--jg-blue);
  font-weight: 750;
}

/* ---------- Buttons ---------- */
.btn {
  min-height: 54px;
  border-radius: 15px;
  font-weight: 850;
  letter-spacing: -.01em;
}
.btn-primary {
  background: linear-gradient(180deg, #2DB25E, #23984F);
  color: #fff;
  box-shadow: 0 10px 24px rgba(40,167,88,.27), inset 0 1px 0 rgba(255,255,255,.18);
}
.btn-primary:hover { filter: brightness(1.025); }
.btn-secondary {
  background: #fff;
  color: var(--jg-blue);
  border: 1px solid rgba(26,49,140,.12);
  box-shadow: 0 8px 20px rgba(26,49,140,.08);
}
.btn-secondary svg { color: var(--jg-green); }
.btn-ghost { color: var(--jg-blue); }

.ctabar {
  padding: 10px 22px calc(var(--safe-bottom) + 16px);
  background: linear-gradient(to top, #F6FAFF 68%, rgba(246,250,255,0));
}
.ctabar .btn-primary {
  min-height: 58px;
  font-size: 17px;
  border-radius: 16px;
}

/* ---------- Camera / share sheet ---------- */
.camera-close,
.camera-flip {
  background: rgba(0,0,0,.45);
  border: 1px solid rgba(255,255,255,.30);
  color: #fff;
}
.camera-shutter {
  border-color: rgba(244,195,69,.72);
  box-shadow: 0 0 0 6px rgba(244,195,69,.18), 0 8px 26px rgba(0,0,0,.40);
}
.camera-hint {
  background: rgba(26,49,140,.78);
  color: #fff;
}
.sheet-scrim { background: rgba(5,17,66,.62); }
.sheet {
  border: 1px solid rgba(26,49,140,.08);
}
.sheet-title { color: var(--jg-blue); }
.sheet-option-icon {
  background: var(--jg-ice);
  color: var(--jg-blue);
}
.sheet-option:nth-child(1) .sheet-option-icon { color: var(--jg-green); }

@media (min-width: 561px) {
  .app {
    margin-top: 16px;
    height: calc(100dvh - 32px);
    border-radius: 30px;
    border: 1px solid rgba(255,255,255,.10);
  }
}

@media (max-height: 720px) {
  .badge-row::before { height: 62px; }
  .landing-title-name { font-size: 30px; }
  .landing-title-eyebrow { font-size: 17px; }
  .landing-sub { font-size: 12.5px; line-height: 1.35; }
  .preview-stack { max-width: 140px; }
  .landing-col-caption { display: none; }
}

@media (max-width: 359px) {
  .screen { padding-left: 17px; padding-right: 17px; }
  .badge-row::before { height: 62px; }
  .landing-title-name { font-size: 28px; }
  .landing-title-eyebrow { font-size: 16px; }
  .landing-sub { font-size: 12.5px; }
  .preview-stack { max-width: 148px; }
  .upload-actions { grid-template-columns: 1fr; }
}

.legal-footer {
  text-align: center;
  font-size: 9px;
  line-height: 1.2;
  color: var(--color-muted-foreground);
  opacity: 0.6;
  margin: 6px 0 0;
}
