/* ─── Modo Foto — visual Urban Market (vertical-first, fluxo de 7 estados) ── */

/* Fontes carregadas via /fonts/fonts.css (woff2 locais, latin + latin-ext) */

:root {
  --yellow: #ffd000;
  --yellow-dim: #b89400;
  --black: #0a0a0a;
  --dark: #111;
  --card: #1a1a1a;
  --card-2: #222;
  --white: #fff;
  --gray: #888;
  --gray-light: #ccc;

  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);

  --edge-pad: clamp(1.4rem, 4vw, 2.4rem);

  --instagram-duration: 10s;

  /* Escala do totem: 1 no celular/desenvolvimento; ver "Tela do totem" abaixo */
  --k: 1;
}

/* ─── Tela do totem (vertical 1080×1920 ou maior) ───────────────────────────
   O layout foi desenhado para ~600 px de largura. Numa tela de totem ele ficava
   como um celular no meio do monitor, com texto de 16 px lido a 1 m de
   distância. Aqui tudo cresce na mesma proporção: px via --k, rem via fonte raiz. */
@media (min-width: 900px) and (min-height: 1400px) {
  :root { --k: 1.7; }
  html { font-size: calc(16px * 1.7); }
}

/* Reset */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  width: 100%;
  height: 100%;
  background: #050505;
  font-family: "Barlow", Arial, Helvetica, sans-serif;
  font-weight: 500;
  color: var(--white);
  overflow: hidden;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

/* Ícones inline (SVG) — herdam cor via currentColor */
.icon {
  width: 1em;
  height: 1em;
  display: inline-block;
  vertical-align: middle;
  fill: currentColor;
  flex-shrink: 0;
}

/* Utilitário para ocultar elementos */
.hidden {
  display: none !important;
}

/* ─── App principal ────────────────────────────────────────────────────── */
#photo-app {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--black);
}

/* Textura de ruído sutil global */
#photo-app::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: 0.35;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.04'/%3E%3C/svg%3E");
}

/* ─── Câmera e foto capturada ──────────────────────────────────────────── */
:root {
  --media-stage-width: min(86vw, calc(720px * var(--k)));
  --media-stage-height: calc(var(--media-stage-width) * 3 / 4);
}

#camera-video,
#captured-photo {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 3;

  width: var(--media-stage-width);
  height: var(--media-stage-height);
  object-fit: cover;
  background: #000;

  opacity: 0;
  visibility: hidden;
  border-radius: calc(14px * var(--k));
  transition: opacity 0.18s ease, border-radius 0.32s ease,
    box-shadow 0.32s ease, transform 0.32s ease;
}

#camera-video {
  transform: translate(-50%, -50%) scaleX(-1);
}

#captured-photo {
  transform: translate(-50%, -50%);
}

#captured-photo.active {
  opacity: 1;
  visibility: visible;
}

#camera-video.active {
  visibility: visible;
}

#camera-video.active.frame-ready {
  opacity: 1;
}

/* Tela INVITE: câmera como viewfinder central */
#photo-app[data-state="invite"] #camera-video.active {
  width: min(78vw, calc(560px * var(--k)));
  height: min(78vw, calc(560px * var(--k)));
  top: 46%;
  border-radius: calc(16px * var(--k));
  box-shadow: 0 calc(24px * var(--k)) calc(60px * var(--k)) rgba(0, 0, 0, 0.7), 0 0 0 calc(1px * var(--k)) #1a1a1a;
  background: linear-gradient(160deg, #1a1a1a, #111);
}

/* Tela PREVIEW: foto emoldurada */
#photo-app[data-state="preview"] #captured-photo.active {
  width: min(78vw, calc(540px * var(--k)));
  height: min(78vw, calc(540px * var(--k)));
  top: 46%;
  border-radius: calc(16px * var(--k));
  box-shadow: 0 calc(24px * var(--k)) calc(60px * var(--k)) rgba(0, 0, 0, 0.7),
    0 0 0 3px rgba(255, 208, 0, 0.18);
}

/* Telas que não mostram câmera/foto */
#photo-app[data-state="lgpd"] #captured-photo.active,
#photo-app[data-state="lgpd"] #camera-video.active,
#photo-app[data-state="countdown"] #captured-photo.active,
#photo-app[data-state="countdown"] #camera-video.active,
#photo-app[data-state="instagram"] #captured-photo.active,
#photo-app[data-state="instagram"] #camera-video.active,
#photo-app[data-state="done"] #camera-video.active,
#photo-app[data-state="done"] #captured-photo.active,
#photo-app[data-state="error"] #camera-video.active,
#photo-app[data-state="error"] #captured-photo.active,
#photo-app[data-state="waiting"] #camera-video.active,
#photo-app[data-state="waiting"] #captured-photo.active {
  opacity: 0;
  visibility: hidden;
}

/* Moldura de cantos: esconde fora da tela INVITE */
#photo-app[data-state="countdown"] #face-frame.active,
#photo-app[data-state="lgpd"] #face-frame.active,
#photo-app[data-state="preview"] #face-frame.active,
#photo-app[data-state="instagram"] #face-frame.active,
#photo-app[data-state="done"] #face-frame.active,
#photo-app[data-state="error"] #face-frame.active,
#photo-app[data-state="waiting"] #face-frame.active {
  opacity: 0;
  visibility: hidden;
}

/* ─── Overlay escuro ───────────────────────────────────────────────────── */
.overlay {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background: radial-gradient(
      ellipse 80% 60% at 50% 55%,
      rgba(28, 21, 0, 0.55) 0%,
      transparent 70%
    ),
    rgba(10, 10, 10, 0.55);
  transition: background 0.35s ease;
}

#photo-app[data-state="lgpd"] .overlay,
#photo-app[data-state="instagram"] .overlay,
#photo-app[data-state="waiting"] .overlay,
#photo-app[data-state="done"] .overlay,
#photo-app[data-state="error"] .overlay {
  background: rgba(10, 10, 10, 0.94);
}

#photo-app[data-state="countdown"] .overlay {
  background: radial-gradient(
    ellipse 70% 50% at 50% 50%,
    rgba(28, 21, 0, 0.85) 0%,
    rgba(10, 10, 10, 0.98) 75%
  );
}

/* ─── Moldura de cantos amarelos (face-frame) ─────────────────────────── */
#face-frame {
  position: absolute;
  z-index: 4;
  top: 46%;
  left: 50%;
  width: min(78vw, calc(560px * var(--k)));
  height: min(78vw, calc(560px * var(--k)));
  transform: translate(-50%, -50%);
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease;
}

#face-frame.active {
  opacity: 1;
  visibility: visible;
}

.corner {
  position: absolute;
  width: calc(38px * var(--k));
  height: calc(38px * var(--k));
  border-color: var(--yellow);
  border-style: solid;
}

.corner.top-left {
  top: calc(12px * var(--k));
  left: calc(12px * var(--k));
  border-width: calc(3px * var(--k)) 0 0 calc(3px * var(--k));
  border-radius: calc(6px * var(--k)) 0 0 0;
}

.corner.top-right {
  top: calc(12px * var(--k));
  right: calc(12px * var(--k));
  border-width: calc(3px * var(--k)) calc(3px * var(--k)) 0 0;
  border-radius: 0 calc(6px * var(--k)) 0 0;
}

.corner.bottom-left {
  bottom: calc(12px * var(--k));
  left: calc(12px * var(--k));
  border-width: 0 0 calc(3px * var(--k)) calc(3px * var(--k));
  border-radius: 0 0 0 calc(6px * var(--k));
}

.corner.bottom-right {
  bottom: calc(12px * var(--k));
  right: calc(12px * var(--k));
  border-width: 0 calc(3px * var(--k)) calc(3px * var(--k)) 0;
  border-radius: 0 0 calc(6px * var(--k)) 0;
}

/* Scan line animada (só durante INVITE) */
/* A linha sobe e desce com `transform` (não com `top`): transform e opacity são
   animados pelo compositor, fora do processo principal — que, nesta tela, fica
   ocupado com o reconhecimento do joinha. Animando `top`, a linha só mudava de
   posição ~1x/s (medido). O #scan-line é uma faixa de 15% a 75% da moldura; a
   linha visível é o ::before no topo dela, e a faixa inteira desliza 100%. */
#scan-line {
  position: absolute;
  left: 4%;
  right: 4%;
  top: 15%;
  height: 60%;
  opacity: 0;
  pointer-events: none;
  z-index: 5;
  will-change: transform, opacity;
}

#scan-line::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: calc(2px * var(--k));
  background: linear-gradient(90deg, transparent, var(--yellow), transparent);
  filter: drop-shadow(0 0 calc(8px * var(--k)) rgba(255, 208, 0, 0.6));
}

#photo-app[data-state="invite"] #scan-line {
  opacity: 0.7;
  animation: scan 2.5s ease-in-out infinite;
}

@keyframes scan {
  0%, 100% { transform: translateY(0);    opacity: 0.3; }
  50%       { transform: translateY(100%); opacity: 0.9; }
}

/* ─── Status do controle por gestos ──────────────────────────────────── */
#hand-status {
  position: absolute;
  bottom: 1.2rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  padding: calc(6px * var(--k)) calc(16px * var(--k));
  background: rgba(0, 0, 0, 0.6);
  border-radius: calc(100px * var(--k));
  font-family: "Barlow Condensed", sans-serif;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: calc(1.5px * var(--k));
  text-transform: uppercase;
  color: var(--gray);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  pointer-events: none;
}

#hand-status.active {
  opacity: 1;
  visibility: visible;
}

#hand-status.success { color: var(--yellow); }
#hand-status.warning { color: #ff8c00; }

/* ─── Telas (containers) ──────────────────────────────────────────────── */
.screen {
  position: absolute;
  inset: 0;
  z-index: 5;

  display: flex;
  flex-direction: column;
  align-items: center;

  /* 4% / 5% da altura: TVs e monitores com overscan escondem 2–5% das bordas;
     botões de baixo ("Não, obrigado", "Refazer") não podem ficar colados nelas. */
  padding-top: max(var(--edge-pad), calc(var(--safe-top) + 1.6rem), 4vh);
  padding-bottom: max(var(--edge-pad), calc(var(--safe-bottom) + 1.6rem), 5vh);
  padding-left: var(--edge-pad);
  padding-right: var(--edge-pad);

  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(calc(12px * var(--k)));

  transition: opacity 0.34s ease, transform 0.34s ease, visibility 0.34s ease;
}

.screen.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0);
}

/* ─── Tela INVITE ─────────────────────────────────────────────────────── */
.invite-screen {
  justify-content: space-between;
}

.invite-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  text-align: center;
  z-index: 6;
}

.invite-icon-wrap {
  width: calc(64px * var(--k));
  height: calc(64px * var(--k));
  background: var(--yellow);
  border-radius: calc(16px * var(--k));
  display: flex;
  align-items: center;
  justify-content: center;
  color: #000;
  margin-bottom: calc(16px * var(--k));
  box-shadow: 0 0 calc(40px * var(--k)) rgba(255, 208, 0, 0.35);
}

.invite-icon-wrap .icon {
  font-size: calc(34px * var(--k));
}

.invite-title {
  font-family: "Bebas Neue", sans-serif;
  font-size: clamp(2.4rem, 6vw, 3.2rem);
  letter-spacing: calc(3px * var(--k));
  color: var(--white);
  line-height: 1;
  margin: 0;
  text-align: center;
}

.invite-subtitle {
  font-family: "Barlow", sans-serif;
  font-size: clamp(1rem, 2.6vw, 1.2rem);
  color: var(--gray-light);
  margin-top: calc(8px * var(--k));
  font-weight: 500;
  letter-spacing: calc(0.5px * var(--k));
}

/* ─── Tela LGPD ───────────────────────────────────────────────────────── */
.lgpd-screen {
  justify-content: flex-start;
  gap: 1.1rem;
}

.lgpd-shield {
  width: calc(78px * var(--k));
  height: calc(78px * var(--k));
  background: linear-gradient(135deg, #1e1800, #2a2000);
  border: calc(2px * var(--k)) solid var(--yellow);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--yellow);
  margin-bottom: calc(4px * var(--k));
  box-shadow: 0 0 calc(30px * var(--k)) rgba(255, 208, 0, 0.2);
}

.lgpd-shield .icon {
  font-size: calc(36px * var(--k));
}

.screen.active .lgpd-shield,
.screen.active .invite-icon-wrap,
.screen.active .check-circle {
  animation: pop-in 0.45s ease both;
}

@keyframes pop-in {
  from { transform: scale(0.7); opacity: 0; }
  to   { transform: scale(1);   opacity: 1; }
}

.lgpd-title {
  font-family: "Bebas Neue", sans-serif;
  font-size: clamp(1.85rem, 5.5vw, 2.6rem);
  letter-spacing: calc(2px * var(--k));
  line-height: 1.05;
  color: var(--white);
  text-align: center;
  margin: 0;
}

.lgpd-subtitle {
  font-family: "Barlow", sans-serif;
  font-size: clamp(0.95rem, 2.4vw, 1.1rem);
  color: var(--yellow);
  margin-top: calc(2px * var(--k));
  margin-bottom: calc(4px * var(--k));
  font-weight: 600;
  letter-spacing: calc(0.3px * var(--k));
  text-align: center;
}

.lgpd-cards {
  display: flex;
  flex-direction: column;
  gap: calc(10px * var(--k));
  width: 100%;
  max-width: calc(560px * var(--k));
  margin-top: 0.6rem;
}

.lgpd-card {
  background: var(--card);
  border-radius: calc(14px * var(--k));
  padding: calc(14px * var(--k)) calc(16px * var(--k));
  border-left: calc(3px * var(--k)) solid var(--yellow);
  display: flex;
  gap: calc(12px * var(--k));
  align-items: flex-start;
}

.lgpd-card .icon {
  font-size: calc(22px * var(--k));
  color: var(--yellow);
  margin-top: calc(1px * var(--k));
  flex-shrink: 0;
}

.lgpd-card-text {
  font-family: "Barlow", sans-serif;
  font-size: clamp(0.85rem, 2vw, 1rem);
  color: var(--gray-light);
  line-height: 1.5;
  text-align: left;
}

.lgpd-card-text strong {
  color: #fff;
  font-weight: 700;
}

.lgpd-privacy {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: calc(6px * var(--k));
  margin-top: 0.8rem;
  width: 100%;
  font-family: "Barlow", sans-serif;
  font-size: 0.78rem;
  color: #555;
  letter-spacing: calc(0.3px * var(--k));
}

.lgpd-privacy .icon {
  font-size: calc(14px * var(--k));
  color: #555;
}

/* ─── Tela COUNTDOWN ──────────────────────────────────────────────────── */
.countdown-screen {
  justify-content: center;
  align-items: center;
  gap: 0;
}

.countdown-label {
  font-family: "Barlow Condensed", sans-serif;
  font-size: clamp(0.8rem, 1.8vw, 0.95rem);
  letter-spacing: calc(4px * var(--k));
  color: var(--yellow);
  text-transform: uppercase;
  margin-bottom: calc(18px * var(--k));
  opacity: 0.9;
  display: inline-flex;
  align-items: center;
  gap: calc(6px * var(--k));
}

.countdown-label .icon {
  font-size: calc(16px * var(--k));
  color: var(--yellow);
}

.countdown-title {
  font-family: "Bebas Neue", sans-serif;
  font-size: clamp(2.2rem, 7vw, 3.5rem);
  letter-spacing: calc(4px * var(--k));
  text-align: center;
  line-height: 1;
  margin: 0 0 calc(30px * var(--k));
  text-transform: uppercase;
}

/* Anel SVG + número central */
.countdown-ring-wrap {
  position: relative;
  width: clamp(calc(160px * var(--k)), 30vw, calc(220px * var(--k)));
  height: clamp(calc(160px * var(--k)), 30vw, calc(220px * var(--k)));
  margin-bottom: calc(30px * var(--k));
}

.countdown-ring-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.countdown-ring-bg {
  fill: none;
  stroke: #1e1e1e;
  stroke-width: 8;
}

.countdown-ring-progress {
  fill: none;
  stroke: var(--yellow);
  stroke-width: 8;
  stroke-linecap: butt;
  /* Circunferência exata de r=80 (2 * PI * 80). Usar o valor cheio evita que o
     traço dê a volta e ultrapasse o início, o que causava um recuo de alguns
     graus ao atingir 100%. --count-progress é adimensional (0 a 1). */
  stroke-dasharray: 502.6548245743669;
  stroke-dashoffset: calc(502.6548245743669 * (1 - var(--count-progress, 0)));
  filter: drop-shadow(0 0 calc(8px * var(--k)) rgba(255, 208, 0, 0.6));
}

#countdown-number {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: "Bebas Neue", sans-serif;
  font-size: clamp(4.5rem, 11vw, 6.5rem);
  color: var(--white);
  letter-spacing: -2px;
  line-height: 1;
}

#countdown-number.tick-pop {
  animation: countdown-pop 0.32s ease both;
}

@keyframes countdown-pop {
  0%   { transform: scale(0.85); }
  55%  { transform: scale(1.08); }
  100% { transform: scale(1);    }
}

.countdown-caption {
  font-family: "Barlow", sans-serif;
  font-size: clamp(1rem, 2.4vw, 1.2rem);
  color: var(--gray-light);
  text-align: center;
  font-weight: 500;
  letter-spacing: calc(0.3px * var(--k));
  line-height: 1.5;
  margin: 0;
}

/* ─── Tela PREVIEW ────────────────────────────────────────────────────── */
.preview-screen {
  justify-content: flex-start;
  gap: 0;
}

.preview-badge {
  display: inline-flex;
  align-items: center;
  gap: calc(6px * var(--k));
  background: rgba(255, 208, 0, 0.12);
  border: calc(1px * var(--k)) solid rgba(255, 208, 0, 0.3);
  border-radius: calc(100px * var(--k));
  padding: calc(5px * var(--k)) calc(14px * var(--k));
  font-family: "Barlow Condensed", sans-serif;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: calc(2px * var(--k));
  color: var(--yellow);
  text-transform: uppercase;
  margin-bottom: calc(12px * var(--k));
}

.preview-title {
  font-family: "Bebas Neue", sans-serif;
  font-size: clamp(2rem, 6vw, 3rem);
  letter-spacing: calc(3px * var(--k));
  line-height: 1;
  margin: 0;
  text-align: center;
  text-transform: uppercase;
}

/* ─── Tela INSTAGRAM / QR ─────────────────────────────────────────────── */
.instagram-screen {
  justify-content: flex-start;
  gap: 1rem;
  text-align: center;
}

.check-circle {
  width: calc(76px * var(--k));
  height: calc(76px * var(--k));
  background: var(--yellow);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #000;
  margin-bottom: calc(8px * var(--k));
  box-shadow: 0 0 calc(40px * var(--k)) rgba(255, 208, 0, 0.4),
    0 0 80px rgba(255, 208, 0, 0.15);
  animation: pulse-check 2.2s ease-in-out infinite;
}

.check-circle .icon {
  font-size: calc(40px * var(--k));
}

@keyframes pulse-check {
  0%, 100% {
    box-shadow: 0 0 calc(40px * var(--k)) rgba(255, 208, 0, 0.4),
      0 0 80px rgba(255, 208, 0, 0.15);
  }
  50% {
    box-shadow: 0 0 calc(60px * var(--k)) rgba(255, 208, 0, 0.6),
      0 0 100px rgba(255, 208, 0, 0.25);
  }
}

.instagram-title {
  font-family: "Bebas Neue", sans-serif;
  font-size: clamp(1.85rem, 5.5vw, 2.6rem);
  letter-spacing: calc(2px * var(--k));
  line-height: 1.05;
  color: var(--white);
  text-align: center;
  margin: 0;
  text-transform: uppercase;
}

.instagram-subtitle {
  font-family: "Barlow", sans-serif;
  font-size: clamp(0.95rem, 2.4vw, 1.1rem);
  color: var(--gray-light);
  margin-top: calc(2px * var(--k));
  font-weight: 500;
  text-align: center;
}

.instagram-divider {
  width: min(92%, calc(520px * var(--k)));
  height: calc(1px * var(--k));
  background: linear-gradient(90deg, transparent, #333, transparent);
  margin: calc(8px * var(--k)) auto;
}

/* ─── Card decorativo de "feed" do Instagram ─────────────────────────── */
.instagram-feed-preview {
  width: min(92%, calc(520px * var(--k)));
  margin: calc(6px * var(--k)) auto 0;
  padding: calc(10px * var(--k)) calc(12px * var(--k)) calc(8px * var(--k));
  background: linear-gradient(180deg, #15151a 0%, #0e0e12 100%);
  border: calc(1px * var(--k)) solid rgba(255, 255, 255, 0.06);
  border-radius: calc(14px * var(--k));
  box-shadow: 0 calc(8px * var(--k)) calc(28px * var(--k)) rgba(0, 0, 0, 0.45);
}

.instagram-feed-handle {
  display: flex;
  align-items: center;
  gap: calc(6px * var(--k));
  margin-bottom: calc(8px * var(--k));
  font-family: "Barlow Condensed", sans-serif;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: calc(0.6px * var(--k));
  color: var(--white);
}

.instagram-feed-handle .icon {
  font-size: calc(16px * var(--k));
  color: var(--yellow);
}

.instagram-feed-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: calc(3px * var(--k));
  border-radius: calc(6px * var(--k));
  overflow: hidden;
}

.instagram-feed-grid span {
  display: block;
  aspect-ratio: 1 / 1;
  background:
    radial-gradient(circle at 30% 30%, rgba(255, 208, 0, 0.18), transparent 60%),
    linear-gradient(135deg, #2a2a2f 0%, #1a1a1f 100%);
  border-radius: calc(2px * var(--k));
}

.instagram-feed-grid span:nth-child(3n) {
  background:
    radial-gradient(circle at 70% 60%, rgba(255, 208, 0, 0.22), transparent 55%),
    linear-gradient(135deg, #1f1f24 0%, #14141a 100%);
}

.instagram-feed-grid span:nth-child(4n) {
  background:
    radial-gradient(circle at 50% 50%, rgba(255, 208, 0, 0.14), transparent 65%),
    linear-gradient(135deg, #25252a 0%, #18181d 100%);
}

.instagram-feed-footer {
  margin-top: calc(8px * var(--k));
  text-align: center;
  font-family: "Barlow Condensed", sans-serif;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: calc(3px * var(--k));
  color: var(--gray);
  text-transform: uppercase;
}

/* Imagem do mosaico configurada pelo admin — cobre o grid decorativo.
   Limita a altura para não dominar o card (o grid original é baixo e largo);
   object-fit: cover recorta a imagem quadrada dentro dessa faixa. */
.instagram-mosaic-img {
  display: block;
  width: 100%;
  height: clamp(calc(140px * var(--k)), 24vh, calc(220px * var(--k)));
  object-fit: cover;
  border-radius: calc(6px * var(--k));
  overflow: hidden;
}

.instagram-content {
  display: flex;
  flex-direction: column;
  gap: calc(10px * var(--k));
  width: min(94vw, calc(560px * var(--k)));
  flex: 1;
  min-height: 0;
}

.qr-row {
  display: flex;
  align-items: center;
  gap: calc(14px * var(--k));
  padding: calc(6px * var(--k)) calc(4px * var(--k)) 0;
}

.qr-card {
  position: relative;
  width: calc(110px * var(--k));
  height: calc(110px * var(--k));
  background: #fff;
  border-radius: calc(14px * var(--k));
  padding: calc(8px * var(--k));
  flex-shrink: 0;
  box-shadow: 0 calc(4px * var(--k)) calc(20px * var(--k)) rgba(255, 208, 0, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
}

.qr-card img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: calc(4px * var(--k));
}

/* Fallback quando o QR não carrega */
#qr-fallback {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #1a1a1a;
  border-radius: calc(14px * var(--k));
}

.qr-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: calc(4px * var(--k));
  text-align: left;
}

.qr-text strong {
  font-family: "Barlow Condensed", sans-serif;
  font-size: clamp(1rem, 2.4vw, 1.1rem);
  font-weight: 900;
  letter-spacing: calc(1px * var(--k));
  color: var(--yellow);
}

.qr-text small {
  font-family: "Barlow", sans-serif;
  font-size: clamp(0.78rem, 1.8vw, 0.9rem);
  color: var(--gray);
  line-height: 1.4;
  font-weight: 500;
}

/* Barra de progresso "voltando..." */
.return-progress {
  width: min(94vw, calc(560px * var(--k)));
  height: calc(6px * var(--k));
  margin-top: 1.2rem;
  overflow: hidden;
  border-radius: calc(999px * var(--k));
  background: rgba(255, 255, 255, 0.12);
}

/* A barra desliza com `transform` (compositor) em vez de crescer em `width`
   (layout, processo principal) — mesmo motivo da linha de varredura. Começa
   inteira fora da trilha, à esquerda, e entra; a trilha (overflow: hidden)
   corta o que sobra, e a ponta direita continua arredondada. */
.return-progress span {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background: var(--yellow);
  transform: translateX(-100%);
  will-change: transform;
}

#photo-app[data-state="instagram"] .return-progress span {
  animation: return-fill var(--instagram-duration) linear forwards;
}

@keyframes return-fill {
  from { transform: translateX(-100%); }
  to   { transform: translateX(0); }
}

/* ─── Botões ──────────────────────────────────────────────────────────── */
.actions {
  display: flex;
  flex-direction: column;
  gap: calc(10px * var(--k));
  width: min(94vw, calc(560px * var(--k)));
  margin-top: auto;
  padding-top: 1rem;
}

.invite-btn {
  width: 100%;
  height: calc(60px * var(--k));
  border: none;
  border-radius: calc(14px * var(--k));
  display: flex;
  align-items: center;
  justify-content: center;
  gap: calc(10px * var(--k));

  font-family: "Barlow Condensed", sans-serif;
  font-size: clamp(1rem, 2.6vw, 1.15rem);
  font-weight: 900;
  letter-spacing: calc(1.5px * var(--k));
  text-transform: uppercase;
  cursor: pointer;
  user-select: none;

  transition: transform 0.15s ease;
}

.invite-btn:active {
  transform: scale(0.98);
}

.invite-btn-label {
  text-align: center;
  line-height: 1;
}

.invite-btn .icon {
  font-size: calc(22px * var(--k));
}

.invite-btn.yes {
  background: var(--yellow);
  color: #000;
  box-shadow: 0 calc(4px * var(--k)) calc(24px * var(--k)) rgba(255, 208, 0, 0.3);
}

.invite-btn.no {
  background: var(--card-2);
  border: calc(1px * var(--k)) solid #333;
  color: var(--gray-light);
  height: calc(54px * var(--k));
  font-size: clamp(0.95rem, 2.4vw, 1.05rem);
}

.invite-btn.no .icon {
  opacity: 0.7;
}

/* ─── Tela DONE ───────────────────────────────────────────────────────── */
.done-screen {
  justify-content: center;
  align-items: center;
}

.done-card {
  padding: 1.6rem 1.5rem;
  background: rgba(5, 5, 5, 0.78);
  border: calc(1px * var(--k)) solid rgba(255, 208, 0, 0.24);
  border-radius: calc(24px * var(--k));
  text-align: center;
  width: min(94vw, calc(560px * var(--k)));
  backdrop-filter: blur(calc(14px * var(--k)));
}

.done-card h2 {
  font-family: "Bebas Neue", sans-serif;
  font-size: clamp(1.6rem, 5vw, 2.4rem);
  letter-spacing: calc(2px * var(--k));
  color: var(--white);
  margin-bottom: 0.6rem;
  text-transform: uppercase;
}

.done-card p {
  color: var(--gray-light);
  font-family: "Barlow", sans-serif;
  font-size: clamp(0.95rem, 2.4vw, 1.1rem);
}

.loader {
  width: calc(64px * var(--k));
  height: calc(64px * var(--k));
  margin: 1.5rem auto 0;
  border: calc(6px * var(--k)) solid rgba(255, 255, 255, 0.12);
  border-top-color: var(--yellow);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ─── Tela ERROR ──────────────────────────────────────────────────────── */
.error-screen {
  justify-content: center;
  align-items: center;
}

.error-card {
  padding: 1.6rem 1.5rem;
  background: rgba(5, 5, 5, 0.85);
  border: calc(1px * var(--k)) solid rgba(255, 208, 0, 0.32);
  border-radius: calc(24px * var(--k));
  text-align: center;
  width: min(94vw, calc(560px * var(--k)));
  backdrop-filter: blur(calc(14px * var(--k)));
}

.error-eyebrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.8rem;
  padding: 0.4rem 0.85rem;
  color: var(--yellow);
  border: calc(1px * var(--k)) solid rgba(255, 208, 0, 0.4);
  border-radius: calc(999px * var(--k));
  font-family: "Barlow Condensed", sans-serif;
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: calc(2px * var(--k));
  line-height: 1;
  text-transform: uppercase;
}

.error-card h1 {
  font-family: "Bebas Neue", sans-serif;
  font-size: clamp(1.6rem, 5vw, 2.3rem);
  letter-spacing: calc(2px * var(--k));
  line-height: 1.05;
  color: var(--white);
  text-transform: uppercase;
  margin-bottom: 0.7rem;
}

.error-card p {
  color: var(--gray-light);
  font-family: "Barlow", sans-serif;
  font-size: clamp(0.95rem, 2.4vw, 1.05rem);
  line-height: 1.5;
}

.btn {
  width: 100%;
  height: calc(56px * var(--k));
  margin-top: 1.2rem;
  padding: 0 1.2rem;
  border: none;
  border-radius: calc(14px * var(--k));

  font-family: "Barlow Condensed", sans-serif;
  font-size: 1rem;
  font-weight: 900;
  letter-spacing: calc(1.5px * var(--k));
  text-transform: uppercase;

  cursor: pointer;
  user-select: none;
  transition: transform 0.15s ease, background 0.2s ease;
}

.btn:active {
  transform: scale(0.98);
}

.btn.primary {
  color: #000;
  background: var(--yellow);
  box-shadow: 0 calc(4px * var(--k)) calc(24px * var(--k)) rgba(255, 208, 0, 0.3);
}

/* ─── Canvas oculto para captura ─────────────────────────────────────── */
#capture-canvas {
  display: none;
}

/* ─── Adaptação para telas largas (paisagem) ─────────────────────────── */
@media (orientation: landscape) and (min-aspect-ratio: 4 / 3) {
  :root {
    --media-stage-width: min(50vh, calc(520px * var(--k)));
    --media-stage-height: calc(var(--media-stage-width) * 3 / 4);
  }

  #photo-app[data-state="invite"] #camera-video.active {
    width: min(46vh, calc(460px * var(--k)));
    height: min(46vh, calc(460px * var(--k)));
    top: 50%;
  }

  #photo-app[data-state="preview"] #captured-photo.active {
    width: min(46vh, calc(460px * var(--k)));
    height: min(46vh, calc(460px * var(--k)));
    top: 46%;
  }

  #face-frame {
    width: min(46vh, calc(460px * var(--k)));
    height: min(46vh, calc(460px * var(--k)));
    top: 50%;
  }

  .actions {
    flex-direction: row;
  }

  .actions .invite-btn {
    flex: 1;
  }

  .invite-btn.no {
    height: calc(60px * var(--k));
  }
}

/* Telas muito baixas: compacta o anel */
@media (max-height: 620px) {
  .countdown-ring-wrap {
    width: calc(140px * var(--k));
    height: calc(140px * var(--k));
    margin-bottom: calc(18px * var(--k));
  }

  #countdown-number {
    font-size: 4rem;
  }
}

/* Termo LGPD no totem: texto legível a ~1 m */
@media (min-width: 900px) and (min-height: 1400px) {
  .lgpd-card-text { font-size: 1.15rem; line-height: 1.5; }
}
