/* =========================================================
   Pisca Pixel — pesquisa de marca
   Direção: sala escura de projeção. Preto profundo, âmbar de
   lâmpada, tipografia larga como cartela de crédito.
   Mobile-first, uma pergunta por tela, sem scroll interno.
   ========================================================= */

:root {
  --ink:      #0A0A0B;   /* fundo */
  --surface:  #141416;   /* cartões e botões */
  --surface2: #1C1C1F;   /* estado hover/press */
  --line:     #2A2A2E;   /* fios */
  --paper:    #F5F5F3;   /* texto principal */
  --dim:      #8C8C86;   /* texto secundário */
  --amber:    #FFB020;   /* acento: a lâmpada que pisca */
  --amber-dk: #8A5C00;
  --red:      #FF5A4D;   /* só erro */

  --pad: 24px;
  --radius: 14px;
  --tap: 56px;

  --font: 'Archivo', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --ease: cubic-bezier(.22, .61, .36, 1);
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
  overflow: hidden;
  /* 'contain' impede o scroll de vazar para a página, mas deixa a gente
     capturar o arrasto para baixo e fazer o refresh por conta própria. */
  overscroll-behavior: contain;
}

body {
  background: var(--ink);
  color: var(--paper);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  text-rendering: optimizeLegibility;
}

/* Vinheta discreta: sensação de projeção, custo zero de performance */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(120% 80% at 50% 40%, transparent 40%, rgba(0,0,0,.55) 100%);
  z-index: 1;
}

/* ---------- Progresso: um quadro de filme por pergunta ---------- */
.progress {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 3px;
  display: flex;
  gap: 2px;
  padding: 0 4px;
  margin-top: env(safe-area-inset-top);
  z-index: 5;
}
.progress__frame {
  flex: 1;
  background: var(--line);
  transition: background .3s var(--ease);
}
.progress__frame.is-done { background: var(--amber); }

/* ---------- Marca ---------- */
.brand {
  position: fixed;
  top: calc(env(safe-area-inset-top) + 18px);
  left: 0; right: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  z-index: 4;
  font-size: 11px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--dim);
}
.brand__name {
  font-variation-settings: 'wdth' 112;
  font-weight: 600;
  color: var(--paper);
}
.brand__label { color: var(--dim); }
.brand__dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--amber);
  box-shadow: 0 0 10px var(--amber);
  animation: blink 3.4s var(--ease) infinite;
}
@keyframes blink {
  0%, 88%, 100% { opacity: 1; }
  92%           { opacity: .12; }
  96%           { opacity: 1; }
}

/* ---------- Telas ---------- */
#stage { position: relative; height: 100%; z-index: 2; }

.screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding:
    calc(env(safe-area-inset-top) + 76px)
    var(--pad)
    calc(env(safe-area-inset-bottom) + 24px);
}
.screen[hidden] { display: none; }
.screen.is-entering { animation: slide-in .28s var(--ease) both; }
@keyframes slide-in {
  from { opacity: 0; transform: translateX(18px); }
  to   { opacity: 1; transform: none; }
}

.screen__body {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 14px;
  min-height: 0;
  /* Rede de segurança: em telas muito baixas, rolar é melhor que cortar. */
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.screen__actions { flex: 0 0 auto; display: grid; gap: 10px; }

/* ---------- Tipografia ---------- */
.h1 {
  font-size: clamp(30px, 8.5vw, 40px);
  font-weight: 600;
  font-variation-settings: 'wdth' 96;
  line-height: 1.1;
  letter-spacing: -.015em;
  margin: 0;
}
.h2 {
  font-size: clamp(22px, 6vw, 28px);
  font-weight: 500;
  line-height: 1.22;
  letter-spacing: -.01em;
  margin: 0;
}
.h3 {
  font-size: clamp(17px, 4.6vw, 20px);
  font-weight: 500;
  line-height: 1.3;
  margin: 0;
}
.h2 em, .h1 em { font-style: normal; color: var(--amber); }

.eyebrow {
  margin: 0;
  font-size: 12px;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--amber);
}
.lede { margin: 0; color: var(--dim); font-size: 16px; }
.lede--dim { font-size: 15px; }
.fine {
  margin: 0;
  font-size: 12px;
  line-height: 1.5;
  color: var(--dim);
  text-align: center;
}
.fine a, .lede a { color: var(--dim); }
.q {
  margin: 4px 0 0;
  font-size: 12px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--dim);
}

/* ---------- Botões ---------- */
.btn {
  appearance: none;
  border: 1px solid transparent;
  border-radius: var(--radius);
  min-height: var(--tap);
  padding: 0 22px;
  font: inherit;
  font-weight: 600;
  font-size: 17px;
  cursor: pointer;
  transition: transform .12s var(--ease), background .18s var(--ease), opacity .18s;
}
.btn:active { transform: scale(.985); }
.btn:disabled { opacity: .35; cursor: default; }
.btn--primary { background: var(--amber); color: #1A1200; }
.btn--ghost {
  background: transparent;
  color: var(--dim);
  border-color: var(--line);
  min-height: 48px;
  font-weight: 500;
  font-size: 15px;
}

/* ---------- Escolhas ---------- */
.choices { display: grid; gap: 8px; }
.choices--grid { grid-template-columns: 1fr 1fr; }
.choices--row { grid-auto-flow: column; grid-auto-columns: 1fr; gap: 6px; }

.choice {
  appearance: none;
  text-align: left;
  min-height: var(--tap);
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--paper);
  font: inherit;
  font-size: 16px;
  cursor: pointer;
  transition: border-color .16s var(--ease), background .16s var(--ease), transform .1s;
}
.choice:active { transform: scale(.985); background: var(--surface2); }
.choice.is-picked {
  border-color: var(--amber);
  background: rgba(255, 176, 32, .1);
  color: var(--amber);
}
.choices--grid .choice, .choice--sm { text-align: center; }
.choice--sm {
  min-height: 50px;
  padding: 8px 6px;
  font-size: 14px;
  line-height: 1.2;
}

/* ---------- Escala 1–5 ---------- */
.scale { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.scale__btn {
  appearance: none;
  aspect-ratio: 1;
  min-height: var(--tap);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--paper);
  font: inherit;
  font-size: 20px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color .16s var(--ease), background .16s var(--ease), transform .1s;
}
.scale__btn:active { transform: scale(.95); }
.scale__btn.is-picked { border-color: var(--amber); background: var(--amber); color: #1A1200; }
.scale__legend {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--dim);
}

/* ---------- Marca: SVG recolorível via mask ---------- */
.mark {
  display: block;
  height: auto;
  aspect-ratio: 731 / 328;
  fill: currentColor;
}
.mark--reveal { width: min(72vw, 300px); color: var(--paper); margin: 0 auto 4px; }
.mark--brand  { width: 78px; color: var(--paper); }
.mark--lock   { width: 118px; color: var(--paper); }
.lockup.is-picked .mark--lock { color: var(--amber); }
.mark--thanks { width: 120px; color: var(--amber); margin: 0 auto 4px; }

/* A logo entra na tela 4 (revelação) e não sai mais. Antes dela, a tela 3
   mediria a leitura da marca visual, não a do nome. */
.brand__mark { display: none; }
body.revealed .brand__name { display: none; }
body.revealed .brand__mark { display: block; }

/* ---------- Cold read: nome neutro, sem tratamento de logo ---------- */
.coldread__name {
  margin: 0 0 6px;
  font-size: clamp(38px, 12vw, 60px);
  font-weight: 500;
  font-variation-settings: 'wdth' 100;
  letter-spacing: -.02em;
  line-height: 1.05;
  text-align: center;
}

/* ---------- Revelação e lockups: aí sim, tratamento de marca ---------- */
.reveal__lockup {
  margin: 0;
  font-size: clamp(28px, 8vw, 38px);
  font-weight: 700;
  font-variation-settings: 'wdth' 122;
  letter-spacing: .01em;
  color: var(--amber);
}
.screen--reveal .screen__body { gap: 8px; }

.lockups { display: grid; gap: 8px; }
.lockup {
  appearance: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 16px 12px;
  min-height: 76px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--paper);
  font: inherit;
  cursor: pointer;
  transition: border-color .16s var(--ease), background .16s var(--ease), transform .1s;
}
.lockup:active { transform: scale(.99); }
.lockup.is-picked { border-color: var(--amber); background: rgba(255, 176, 32, .1); }
.lockup__mark { font-size: 20px; font-weight: 700; letter-spacing: .02em; }
.lockup__desc {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: .34em;
  text-transform: uppercase;
  color: var(--dim);
  padding-left: .34em;
}
.lockup.is-picked .lockup__desc { color: var(--amber); }

/* ---------- Gravação: o momento principal ---------- */
.rec { justify-items: center; gap: 14px; }
.strip {
  width: 100%;
  max-width: 460px;
  height: 96px;
  display: block;
}
.rec__status {
  margin: 0;
  font-size: 13px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--dim);
  text-align: center;
  min-height: 20px;
}
.rec__status.is-live { color: var(--amber); }

.rec__btn {
  position: relative;
  width: 88px; height: 88px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  justify-self: center;
}
.rec__ring {
  position: absolute;
  inset: 0;
  border: 2px solid var(--line);
  border-radius: 50%;
  transition: border-color .2s var(--ease), transform .2s var(--ease);
}
.rec__core {
  position: absolute;
  inset: 14px;
  border-radius: 50%;
  background: var(--paper);
  transition: background .2s var(--ease), transform .2s var(--ease);
}
.rec__btn:active .rec__core { transform: scale(.94); }
.rec__btn.is-live .rec__ring { border-color: var(--amber); animation: pulse 1.4s ease-out infinite; }
.rec__btn.is-live .rec__core { background: var(--amber); border-radius: 22%; transform: scale(.72); }
@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 rgba(255,176,32,.45); }
  100% { box-shadow: 0 0 0 22px rgba(255,176,32,0); }
}

.rec__review { display: grid; gap: 12px; width: 100%; }
.rec__review audio { width: 100%; height: 40px; }
.rec__review-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

/* ---------- Texto livre ---------- */
.textarea {
  width: 100%;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--paper);
  font: inherit;
  font-size: 16px;
  resize: none;
}
.textarea:focus { outline: none; border-color: var(--amber); }
.counter { margin: 0; font-size: 12px; color: var(--dim); text-align: right; }

/* ---------- Perfil: cabe tudo numa tela ---------- */
.screen--profile .screen__body { gap: 8px; justify-content: center; }
.screen--profile .h2 { margin-bottom: 6px; }

/* ---------- Agradecimento ---------- */
.screen--thanks .screen__body { gap: 18px; }
.tally {
  margin: 0;
  font-size: 14px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--dim);
}
.tally strong {
  font-size: 22px;
  font-weight: 700;
  color: var(--amber);
  font-variation-settings: 'wdth' 118;
}

/* ---------- Consentimento ---------- */
.consent {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-top: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  cursor: pointer;
}
.consent input { position: absolute; opacity: 0; width: 0; height: 0; }
.consent__box {
  flex: 0 0 auto;
  width: 24px; height: 24px;
  border: 1px solid var(--line);
  border-radius: 6px;
  margin-top: 1px;
  transition: background .16s, border-color .16s;
}
.consent input:checked + .consent__box {
  background: var(--amber);
  border-color: var(--amber);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231A1200' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E");
  background-size: 16px;
  background-repeat: no-repeat;
  background-position: center;
}
.consent input:focus-visible + .consent__box { outline: 2px solid var(--amber); outline-offset: 2px; }
.consent__text { font-size: 14px; color: var(--dim); line-height: 1.4; }

/* Honeypot */
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* ---------- Arrastar para atualizar ---------- */
.ptr {
  position: fixed;
  top: 0; left: 50%;
  z-index: 8;
  width: 34px; height: 34px;
  margin-left: -17px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--surface2);
  border: 1px solid var(--line);
  opacity: 0;
  transform: translateY(-46px);
  pointer-events: none;
}
.ptr__dot {
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--dim);
  transition: background .15s var(--ease), transform .15s var(--ease);
}
.ptr.is-armed { border-color: var(--amber); }
.ptr.is-armed .ptr__dot { background: var(--amber); transform: scale(1.25); }
.ptr.is-loading {
  transition: transform .2s var(--ease), opacity .2s var(--ease);
  transform: translateY(18px);
  opacity: 1;
}
.ptr.is-loading .ptr__dot {
  background: var(--amber);
  animation: blink .9s var(--ease) infinite;
}

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom) + 16px);
  transform: translateX(-50%);
  z-index: 10;
  max-width: min(92vw, 440px);
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface2);
  color: var(--paper);
  font-size: 14px;
  text-align: center;
  box-shadow: 0 10px 30px rgba(0,0,0,.5);
}
.toast[hidden] { display: none; }
.toast.is-error { border-color: var(--red); color: var(--red); }
.toast button {
  margin-left: 10px;
  border: 0;
  background: none;
  color: var(--amber);
  font: inherit;
  font-weight: 600;
  text-decoration: underline;
  cursor: pointer;
}

/* ---------- Foco visível ---------- */
:focus-visible { outline: 2px solid var(--amber); outline-offset: 3px; }

/* ---------- Telas curtas ---------- */
@media (max-height: 700px) {
  :root { --pad: 20px; --tap: 50px; }
  .screen { padding-top: calc(env(safe-area-inset-top) + 64px); }
  .screen__body { gap: 10px; }
  .rec__btn { width: 74px; height: 74px; }
  .strip { height: 76px; }
  .choice { min-height: 50px; font-size: 15px; }
}

/* ---------- Telas estreitas ---------- */
@media (max-width: 380px) {
  .choice--sm { font-size: 12.5px; padding: 8px 4px; }
  .choices--row { gap: 4px; }
  .lockup__desc { letter-spacing: .28em; }
}

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