/* ── TOKENS ──────────────────────────────────────────────────── */
:root {
  --bg:        #07070f;
  --surface:   rgba(255,255,255,0.05);
  --surface-2: rgba(255,255,255,0.08);
  --border:    rgba(255,255,255,0.10);
  --border-2:  rgba(255,255,255,0.16);
  --text:      #f0f1f5;
  --muted:     #9099aa;
  --primary:   #f7c948;
  --accent:    #7c3aed;
  --success:   #22c55e;
  --danger:    #ef4444;
  --radius:    20px;
  --radius-sm: 14px;
}

/* ── RESET ───────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
h1, h2, h3, p { margin: 0; }
button, a { -webkit-tap-highlight-color: transparent; }

/* ── BASE — layout fixo, sem scroll ─────────────────────────── */
html, body {
  margin: 0;
  height: 100dvh;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", sans-serif;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
}

/* ── SHELL ───────────────────────────────────────────────────── */
.app-shell {
  height: 100dvh;
  overflow: hidden;
  display: grid;
  place-items: center;
  padding: 10px;
  background: radial-gradient(ellipse at 50% 0%, #141830 0%, #060608 55%);
}

.phone-frame {
  width: min(100%, 430px);
  height: calc(100dvh - 20px);
  max-height: 932px; /* iPhone 14 Pro Max */
  display: flex;
  flex-direction: column;
  background: linear-gradient(160deg, rgba(255,255,255,0.045) 0%, rgba(255,255,255,0.02) 100%);
  border: 1px solid var(--border);
  border-radius: 28px;
  box-shadow:
    0 32px 80px rgba(0,0,0,0.6),
    0 0 0 0.5px rgba(255,255,255,0.04) inset;
  backdrop-filter: blur(20px);
  overflow: hidden;
}

/* ── TOPBAR ──────────────────────────────────────────────────── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  background: rgba(10,11,16,0.75);
  backdrop-filter: blur(16px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar__logo {
  display: flex;
  align-items: center;
  gap: 7px;
}

.topbar__logo-icon {
  font-size: 14px;
  color: var(--primary);
  filter: drop-shadow(0 0 5px rgba(247,201,72,0.6));
}

.topbar__logo-text {
  font-size: 15px;
  font-weight: 800;
  letter-spacing: -0.3px;
  background: linear-gradient(135deg, var(--primary) 0%, #fff 70%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.topbar__tenant {
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.2px;
}

/* ── SCREENS ─────────────────────────────────────────────────── */
.screen {
  display: none;
  flex: 1;
  min-height: 0; /* crítico para flex shrink funcionar */
  padding: 16px 18px 20px;
  overflow: hidden;
}

.screen.active {
  display: flex;
  flex-direction: column;
  animation: screenIn 0.28s ease forwards;
}

/* Home pode rolar se a tela for muito pequena */
#screen-home {
  overflow-y: auto;
}

@keyframes screenIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── TIPOGRAFIA ──────────────────────────────────────────────── */
h1 {
  font-size: clamp(26px, 7vw, 32px);
  font-weight: 800;
  line-height: 1.08;
  letter-spacing: -0.6px;
}

h2 {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.3px;
}

.section-head {
  margin-bottom: 12px;
}

.section-head p {
  color: var(--muted);
  font-size: 14px;
  margin-top: 4px;
}

.hint {
  font-size: 13px;
  color: var(--muted);
  min-height: 18px;
  margin-top: 8px;
}

.microcopy {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.4;
  margin-top: 8px;
}

/* ── HOME / HERO ─────────────────────────────────────────────── */
.hero {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Painel visual de transformação */
.hero__visual {
  position: relative;
  height: 210px;
  border-radius: 22px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  border: 1px solid var(--border);
}

.hero__visual-bg {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(145deg, #0d0f20 0%, #111228 50%, #0d0f1c 100%);
  z-index: 0;
}

.hero__visual-bg::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 25% 50%, rgba(247,201,72,.18) 0%, transparent 50%),
    radial-gradient(circle at 75% 50%, rgba(124,58,237,.18) 0%, transparent 50%);
}

/* Círculos de avatar */
.hero__frame {
  position: relative;
  z-index: 1;
  width: 80px;
  height: 80px;
  border-radius: 999px;
  background: rgba(255,255,255,0.06);
  border: 1.5px solid rgba(255,255,255,0.12);
  display: grid;
  place-items: center;
  font-size: 34px;
}

.hero__frame--after {
  background: rgba(247,201,72,0.10);
  border-color: rgba(247,201,72,0.35);
  animation: glowPulse 2.8s ease-in-out infinite;
}

.hero__frame-glow {
  position: absolute;
  inset: -12px;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(124,58,237,.25), transparent 70%);
  filter: blur(10px);
  z-index: -1;
}

/* Seta central */
.hero__arrow {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.hero__arrow-line {
  width: 28px;
  height: 1.5px;
  background: linear-gradient(90deg, rgba(255,255,255,.2), rgba(247,201,72,.8));
  border-radius: 2px;
}

.hero__arrow-spark {
  font-size: 13px;
  color: var(--primary);
  animation: sparkSpin 3s linear infinite;
}

/* Área de texto */
.hero__copy {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.hero__tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(247,201,72,0.08);
  border: 1px solid rgba(247,201,72,0.22);
  color: #f7c948;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  width: fit-content;
}

.hero__title-highlight {
  background: linear-gradient(135deg, var(--primary) 0%, #fff 80%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero__copy p {
  font-size: 15px;
  color: var(--muted);
  line-height: 1.5;
}

/* Features row */
.hero__features {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
}

.hero__sep {
  opacity: 0.35;
}

/* ── BOTÕES — BASE ───────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 20px;
  min-height: 50px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.1px;
  color: #fff;
  background: var(--surface);
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.1s ease, opacity 0.15s ease, box-shadow 0.15s ease;
  -webkit-user-select: none;
  user-select: none;
}

.btn:active  { transform: scale(0.97); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

.btn__icon  { font-size: 18px; line-height: 1; }
.btn__arrow { font-size: 16px; margin-left: 2px; opacity: 0.7; }

/* CTA principal — tela home */
.btn--cta {
  width: 100%;
  min-height: 58px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--primary) 0%, #e8a820 100%);
  color: #07070f;
  border: none;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -0.2px;
  box-shadow:
    0 0 0 1px rgba(247,201,72,.25),
    0 8px 32px rgba(247,201,72,.30),
    0 2px 8px rgba(232,168,32,.25);
}
.btn--cta:active {
  transform: scale(0.975);
  box-shadow: 0 4px 16px rgba(247,201,72,.25);
}

/* Primary */
.btn--primary {
  background: linear-gradient(135deg, var(--primary) 0%, #e8a820 100%);
  color: #07070f;
  font-weight: 700;
  border-color: transparent;
  box-shadow: 0 4px 20px rgba(247,201,72,.28);
}

/* Success */
.btn--success {
  background: linear-gradient(160deg, #34d369 0%, var(--success) 100%);
  color: #052010;
  font-weight: 700;
  box-shadow: 0 4px 16px rgba(34,197,94,.22);
}

/* Ghost — secundário */
.btn--ghost {
  background: rgba(255,255,255,0.07);
  border-color: var(--border-2);
  color: var(--text);
}
.btn--ghost:active {
  background: rgba(255,255,255,0.12);
}

/* Full width */
.btn--full { width: 100%; }

/* Ícone quadrado */
.btn--icon {
  min-height: 46px;
  width: 46px;
  padding: 0;
  border-radius: 14px;
}

/* Sociais */
.btn--social {
  background: rgba(255,255,255,0.06);
  border-color: var(--border);
  font-size: 14px;
  font-weight: 600;
  min-height: 46px;
}
.btn--social-wa { color: #4ade80; border-color: rgba(74,222,128,.18); }
.btn--social-ig { color: #f472b6; border-color: rgba(244,114,182,.18); }
.btn--social-fb { color: #60a5fa; border-color: rgba(96,165,250,.18); }

/* ── CÂMERA ───────────────────────────────────────────────────── */
#screen-camera {
  gap: 0; /* controla espaçamento manualmente */
}

.section-head {
  flex-shrink: 0;
  margin-bottom: 10px;
}

.camera-wrap {
  position: relative;
  flex: 1;
  min-height: 0; /* crítico — permite shrink */
  border-radius: 20px;
  overflow: hidden;
  background: #000;
  border: 1px solid var(--border);
}

video, #photo-preview {
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #000;
  display: block;
}

.camera-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: 20px;
}

.camera-overlay::before {
  content: "";
  position: absolute;
  inset: 10% 8%;
  border: 1.5px dashed rgba(255,255,255,0.28);
  border-radius: 999px;
}

.hidden { display: none !important; }
.mirror { transform: scaleX(-1); }

.hint {
  flex-shrink: 0;
  font-size: 13px;
  color: var(--muted);
  min-height: 16px;
  margin-top: 6px;
  text-align: center;
}

/* Área de ações da câmera — sempre visível no rodapé */
.sticky-actions {
  flex-shrink: 0;
  margin-top: 10px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 10px 12px 12px;
}

.capture-row {
  display: grid;
  grid-template-columns: 52px 1fr 52px;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.capture-spacer { width: 52px; height: 52px; }

/* Botão de captura */
.capture-btn {
  position: relative;
  width: 72px;
  height: 72px;
  border-radius: 999px;
  border: none;
  background: transparent;
  display: grid;
  place-items: center;
  margin: 0 auto;
  cursor: pointer;
}
.capture-btn:disabled { opacity: 0.45; }

.capture-btn__ring {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  border: 3px solid rgba(255,255,255,0.30);
}

.capture-btn__inner {
  width: 56px;
  height: 56px;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 2px 12px rgba(0,0,0,0.3);
}

.capture-btn--pulse { animation: capturePulse 0.38s ease forwards; }

.action-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

/* ── PROCESSANDO ─────────────────────────────────────────────── */
.processing {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 14px;
  position: relative;
  overflow: hidden;
  padding: 0 4px;
}

.processing__bg-orb {
  position: absolute;
  top: 40%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 360px;
  height: 360px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(247,201,72,.12), rgba(124,58,237,.10), transparent 65%);
  filter: blur(32px);
  animation: orbFloat 3.4s ease-in-out infinite;
  pointer-events: none;
  z-index: 0;
}

.processing__stages {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  width: 100%;
  max-width: 320px;
  margin: 4px auto;
  position: relative;
  z-index: 1;
}

.processing__stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  flex: 0 0 auto;
  opacity: 0.22;
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.processing__stage.stage--active {
  opacity: 1;
  transform: scale(1.1);
}

.processing__stage.stage--done { opacity: 0.5; }

.processing__stage-icon {
  width: 54px;
  height: 54px;
  border-radius: 16px;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  display: grid;
  place-items: center;
  font-size: 22px;
  transition: background 0.4s ease, border-color 0.4s ease, box-shadow 0.4s ease;
}

.processing__stage.stage--active .processing__stage-icon {
  background: rgba(247,201,72,.15);
  border-color: rgba(247,201,72,.42);
  box-shadow: 0 0 22px rgba(247,201,72,.25);
}

.processing__stage.stage--done .processing__stage-icon {
  background: rgba(34,197,94,.10);
  border-color: rgba(34,197,94,.22);
}

.processing__stage-label {
  font-size: 11px;
  color: var(--muted);
  font-weight: 500;
}

.processing__connector {
  flex: 1;
  height: 1.5px;
  background: rgba(255,255,255,0.08);
  margin-top: 27px;
  min-width: 10px;
  max-width: 32px;
  transition: background 0.5s ease;
}

.processing__connector.connector--done {
  background: rgba(34,197,94,.50);
}

.processing h2 { position: relative; z-index: 1; }

.processing__status {
  color: var(--muted);
  font-size: 15px;
  position: relative;
  z-index: 1;
}

.processing__fun {
  font-size: 13px;
  color: rgba(255,255,255,0.32);
  min-height: 18px;
  font-style: italic;
  transition: opacity 0.4s ease;
  position: relative;
  z-index: 1;
}

.processing__timer {
  font-size: 12px;
  color: rgba(255,255,255,0.18);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.5px;
  position: relative;
  z-index: 1;
}

/* ── RESULTADO ───────────────────────────────────────────────── */
#screen-result {
  gap: 0;
}

.result-card {
  flex: 1;
  min-height: 0; /* crítico */
  margin-top: 12px;
  border-radius: 20px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.02);
  padding: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.result-card img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  border-radius: 14px;
  opacity: 0;
}

.result-card img.result--revealed {
  animation: resultReveal 0.55s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.share-section {
  flex-shrink: 0;
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.share-primary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

/* ── ERRO ────────────────────────────────────────────────────── */
.error-card {
  margin-top: 48px;
  text-align: center;
  border-radius: 22px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  padding: 32px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.error-card__icon { font-size: 36px; }
.error-card p { color: var(--muted); font-size: 15px; line-height: 1.5; }

/* ── FILL-LIGHT (iluminação frontal antes de capturar) ──────── */
#camera-fill-light {
  position: fixed;
  inset: 0;
  background: #fff;
  z-index: 9999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.08s ease;
}
#camera-fill-light.active { opacity: 1; }

/* ── FLASH E ANIMAÇÕES ───────────────────────────────────────── */
.camera-wrap::after {
  content: "";
  position: absolute;
  inset: 0;
  background: #fff;
  pointer-events: none;
  opacity: 0;
  border-radius: 22px;
  z-index: 5;
}
.camera-wrap.camera--flash::after {
  animation: flashEffect 0.42s ease forwards;
}

@keyframes flashEffect {
  0%   { opacity: 0; }
  18%  { opacity: 0.80; }
  100% { opacity: 0; }
}

@keyframes capturePulse {
  0%   { transform: scale(1); }
  28%  { transform: scale(1.12); }
  62%  { transform: scale(0.95); }
  100% { transform: scale(1); }
}

@keyframes resultReveal {
  from { opacity: 0; transform: scale(0.94) translateY(10px); }
  to   { opacity: 1; transform: scale(1)    translateY(0); }
}

@keyframes orbFloat {
  0%, 100% { transform: translate(-50%, -50%) scale(1);    opacity: 0.7; }
  50%       { transform: translate(-50%, -50%) scale(1.28); opacity: 1;   }
}

@keyframes glowPulse {
  0%, 100% { box-shadow: 0 0 18px rgba(247,201,72,.20); }
  50%       { box-shadow: 0 0 36px rgba(247,201,72,.40); }
}

@keyframes sparkSpin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

/* ── RESPONSIVIDADE ──────────────────────────────────────────── */
/* Telas pequenas (iPhone SE 375px) */
@media (max-width: 390px) {
  h1 { font-size: 24px; }
  .hero__visual { height: 160px; }
  .hero__frame { width: 64px; height: 64px; font-size: 26px; }
  .btn--cta { min-height: 52px; font-size: 15px; }
  .processing__stages { max-width: 270px; }
  .processing__stage-icon { width: 46px; height: 46px; font-size: 19px; }
  .processing__connector { margin-top: 23px; max-width: 22px; }
}

/* Telas baixas (landscape) */
@media (max-height: 680px) {
  .hero__visual { height: 130px; }
  .hero__copy h1 { font-size: 22px; }
  .processing { gap: 10px; }
  .processing__stage-icon { width: 44px; height: 44px; font-size: 18px; }
  .sticky-actions { padding: 8px 10px 10px; }
  .capture-btn { width: 62px; height: 62px; }
  .capture-btn__inner { width: 48px; height: 48px; }
}

/* Desktop / tablet */
@media (min-width: 700px) {
  .app-shell { padding: 20px; }
  .phone-frame { max-height: 900px; }
}

/* ── PROMPT SELECT (legado) ──────────────────────────────────── */
.card-inline {
  margin-top: 12px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 12px;
  display: grid;
  gap: 10px;
}

#prompt-select {
  width: 100%;
  min-height: 48px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 15px;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
}

#prompt-select:disabled { opacity: .5; }
#prompt-select:focus {
  border-color: rgba(79,142,247,.55);
  box-shadow: 0 0 0 3px rgba(79,142,247,.14);
}
