/* =====================================================================
   CALCULADORA DO PREJUÍZO INVISÍVEL DO FIADO — MultCard
   ---------------------------------------------------------------------
   CONCEITO VISUAL
   O produto vive na fronteira entre dois mundos do supermercado:
   1) o TERMINAL DE PDV — tela escura, monoespaçada, fósforo verde —
      onde o problema é digitado e calculado (perguntas, progresso).
   2) o CUPOM FISCAL — papel claro, "impresso", com itens e total —
      onde o problema se torna palpável (tela de resultado).
   A jornada do usuário atravessa esse contraste de propósito:
   do dado invisível ao prejuízo impresso, em preto no branco.
   ===================================================================== */

/* ---------- Design tokens ------------------------------------------ */
:root {
  /* Cor */
  --ink-950: #0a120e;      /* fundo terminal */
  --ink-900: #0f1b15;
  --ink-800: #16261e;
  --phosphor: #33e08a;      /* verde fósforo — ação, avanço */
  --phosphor-dim: #1e8a5b;
  --paper: #f2efe3;         /* papel de cupom */
  --paper-dim: #e7e2d1;
  --paper-line: #cfc9b4;
  --alert: #ff5a4e;         /* prejuízo, perigo */
  --alert-dim: #7a2a24;
  --amber: #f2b544;         /* atenção */
  --ink-text: #eaf3ec;
  --ink-text-dim: #9db6a9;
  --paper-text: #1c2620;
  --paper-text-dim: #5c6a60;

  /* Tipografia */
  --font-mono: 'IBM Plex Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace;
  --font-sans: 'Manrope', -apple-system, BlinkMacSystemFont, sans-serif;

  /* Layout */
  --radius-sm: 6px;
  --radius-md: 14px;
  --radius-lg: 22px;
  --shadow-lift: 0 24px 60px -20px rgba(0,0,0,0.55);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

/* ---------- Reset / base -------------------------------------------- */
* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  background: var(--ink-950);
  color: var(--ink-text);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
}
body { min-height: 100vh; overflow-x: hidden; }
h1, h2, h3 { margin: 0; font-family: var(--font-sans); }
p { margin: 0; }
button { font-family: inherit; cursor: pointer; }
input, select { font-family: inherit; }
ul { list-style: none; margin: 0; padding: 0; }

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* Fundo com scanlines sutis — textura do terminal */
.bg-scanlines {
  position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background:
    radial-gradient(ellipse 80% 60% at 50% -10%, rgba(51,224,138,0.10), transparent 60%),
    repeating-linear-gradient(0deg, rgba(255,255,255,0.018) 0px, rgba(255,255,255,0.018) 1px, transparent 1px, transparent 3px);
}

/* ---------- App shell / screen switching ----------------------------- */
.app { position: relative; z-index: 1; min-height: 100vh; }
.screen {
  display: none;
  min-height: 100vh;
  align-items: center;
  justify-content: center;
  padding: 32px 20px;
}
.screen.is-active { display: flex; }
.screen--result.is-active { align-items: flex-start; padding-top: 56px; padding-bottom: 80px; }

/* Eyebrow padrão */
.eyebrow {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--phosphor);
  margin-bottom: 14px;
}

/* ---------- Botões ---------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: none; border-radius: 999px;
  padding: 14px 26px;
  font-size: 15px; font-weight: 700;
  transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease), background 0.2s var(--ease);
}
.btn--primary {
  background: var(--phosphor);
  color: #08130d;
  box-shadow: 0 0 0 0 rgba(51,224,138,0.5);
}
.btn--primary:hover { transform: translateY(-2px); box-shadow: 0 10px 30px -8px rgba(51,224,138,0.55); }
.btn--primary:active { transform: translateY(0); }
.btn-arrow { transition: transform 0.2s var(--ease); }
.btn--primary:hover .btn-arrow { transform: translateX(3px); }

.btn--ghost {
  background: transparent;
  color: var(--ink-text-dim);
  border: 1px solid rgba(255,255,255,0.14);
}
.btn--ghost:hover { color: var(--ink-text); border-color: rgba(255,255,255,0.3); }

.btn--lg { padding: 17px 34px; font-size: 16px; }
.btn--block { width: 100%; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none !important; box-shadow: none !important; }

/* =====================================================================
   TELA 0 — INTRO (terminal)
   ===================================================================== */
.terminal-frame {
  width: 100%; max-width: 640px;
  background: linear-gradient(180deg, var(--ink-900), var(--ink-950));
  border: 1px solid rgba(51,224,138,0.18);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lift);
  overflow: hidden;
  animation: rise 0.7s var(--ease) both;
}
@keyframes rise { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: translateY(0); } }

.terminal-topbar {
  display: flex; align-items: center; gap: 8px;
  padding: 14px 18px;
  background: rgba(255,255,255,0.03);
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.terminal-dot { width: 9px; height: 9px; border-radius: 50%; background: rgba(255,255,255,0.15); }
.terminal-label {
  margin-left: 8px;
  font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.1em;
  color: var(--ink-text-dim); text-transform: uppercase;
}

.terminal-body { padding: 44px 40px 40px; }
.intro-title {
  font-size: clamp(28px, 4.4vw, 40px);
  line-height: 1.15;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--ink-text);
  margin-bottom: 18px;
}
.intro-title .hl { color: var(--phosphor); }
.intro-sub {
  font-size: 17px; line-height: 1.55;
  color: var(--ink-text-dim);
  max-width: 46ch;
  margin-bottom: 32px;
}
.intro-meta {
  margin-top: 18px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-text-dim);
  letter-spacing: 0.02em;
}

/* =====================================================================
   TELA 1 — QUIZ
   ===================================================================== */
.quiz-shell { width: 100%; max-width: 640px; }

.tape-progress { margin-bottom: 18px; }
.tape-progress-track {
  height: 6px; border-radius: 999px; background: rgba(255,255,255,0.08);
  overflow: hidden;
}
.tape-progress-fill {
  height: 100%; width: 14.28%;
  background: linear-gradient(90deg, var(--phosphor-dim), var(--phosphor));
  border-radius: 999px;
  transition: width 0.5s var(--ease);
}
.tape-progress-meta {
  display: flex; justify-content: space-between;
  margin-top: 10px;
  font-family: var(--font-mono); font-size: 12px;
  color: var(--ink-text-dim); letter-spacing: 0.04em;
}

.quiz-card {
  background: linear-gradient(180deg, var(--ink-900), var(--ink-950));
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lift);
  padding: 40px 36px 30px;
  min-height: 320px;
  display: flex; flex-direction: column;
}

.step { display: none; flex: 1; animation: stepIn 0.4s var(--ease) both; }
.step.is-active { display: block; }
@keyframes stepIn { from { opacity: 0; transform: translateX(14px); } to { opacity: 1; transform: translateX(0); } }

.step-eyebrow {
  font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--phosphor); margin-bottom: 10px;
}
.step-question {
  font-size: clamp(20px, 3vw, 25px);
  font-weight: 700; line-height: 1.3;
  color: var(--ink-text);
  margin-bottom: 26px;
  max-width: 42ch;
}
.step-hint { margin-top: 14px; font-size: 13px; color: var(--ink-text-dim); }

/* Campo monetário */
.field-money {
  display: flex; align-items: center; gap: 10px;
  border-bottom: 2px solid rgba(255,255,255,0.14);
  padding-bottom: 10px;
  transition: border-color 0.2s var(--ease);
}
.field-money:focus-within { border-color: var(--phosphor); }
.field-prefix { font-family: var(--font-mono); font-size: 22px; color: var(--phosphor); }
.input--money {
  background: transparent; border: none; outline: none;
  font-family: var(--font-mono); font-size: 30px; font-weight: 600;
  color: var(--ink-text); width: 100%; letter-spacing: 0.01em;
}
.input--money::placeholder { color: rgba(234,243,236,0.25); }

/* Slider */
.slider-wrap { padding-top: 6px; }
.slider-readout {
  font-family: var(--font-mono); font-size: 44px; font-weight: 700;
  color: var(--phosphor); margin-bottom: 18px;
}
.slider {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 6px; border-radius: 999px;
  background: rgba(255,255,255,0.1);
  outline: none;
}
.slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--phosphor);
  border: 4px solid var(--ink-950);
  box-shadow: 0 0 0 2px var(--phosphor);
  cursor: pointer;
  transition: transform 0.15s var(--ease);
}
.slider::-webkit-slider-thumb:hover { transform: scale(1.12); }
.slider::-moz-range-thumb {
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--phosphor); border: 4px solid var(--ink-950);
  box-shadow: 0 0 0 2px var(--phosphor); cursor: pointer;
}
.slider-scale {
  display: flex; justify-content: space-between; margin-top: 10px;
  font-family: var(--font-mono); font-size: 11px; color: var(--ink-text-dim);
}

/* Opções (radio chips) */
.option-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px;
}
.option-grid--single { grid-template-columns: repeat(2, 1fr); }
.option-chip {
  position: relative;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: var(--radius-md);
  padding: 14px 10px;
  text-align: center;
  font-size: 14px; font-weight: 600;
  color: var(--ink-text-dim);
  cursor: pointer;
  transition: border-color 0.2s var(--ease), color 0.2s var(--ease), background 0.2s var(--ease);
}
.option-chip input { position: absolute; opacity: 0; pointer-events: none; }
.option-chip:hover { border-color: rgba(51,224,138,0.4); color: var(--ink-text); }
.option-chip:has(input:checked) {
  border-color: var(--phosphor);
  background: rgba(51,224,138,0.1);
  color: var(--phosphor);
}

/* Campo numérico com stepper */
.field-number { display: flex; align-items: center; gap: 16px; }
.stepper-btn {
  width: 44px; height: 44px; border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.15);
  background: transparent; color: var(--ink-text);
  font-size: 20px; line-height: 1;
  transition: border-color 0.2s var(--ease), color 0.2s var(--ease);
}
.stepper-btn:hover { border-color: var(--phosphor); color: var(--phosphor); }
.input--number {
  width: 100px; text-align: center;
  background: transparent; border: none; outline: none;
  border-bottom: 2px solid rgba(255,255,255,0.14);
  font-family: var(--font-mono); font-size: 30px; font-weight: 600;
  color: var(--ink-text); padding-bottom: 8px;
}

.step-nav {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 30px; padding-top: 22px;
  border-top: 1px solid rgba(255,255,255,0.06);
}

/* =====================================================================
   TELA 2 — CAPTURA DE LEAD
   ===================================================================== */
.lead-card {
  width: 100%; max-width: 520px;
  background: linear-gradient(180deg, var(--ink-900), var(--ink-950));
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lift);
  padding: 40px 36px;
  animation: rise 0.5s var(--ease) both;
}
.lead-title { font-size: 24px; font-weight: 800; margin-bottom: 10px; color: var(--ink-text); }
.lead-sub { font-size: 14px; color: var(--ink-text-dim); margin-bottom: 26px; line-height: 1.5; }
.lead-form { display: flex; flex-direction: column; gap: 16px; }
.lead-row { display: grid; grid-template-columns: 1fr 100px; gap: 12px; }
.lead-field label {
  display: block; font-size: 12px; font-family: var(--font-mono);
  letter-spacing: 0.04em; color: var(--ink-text-dim); margin-bottom: 6px;
}
.lead-field .req { color: var(--alert); }
.lead-field input, .lead-field select {
  width: 100%; background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.12); border-radius: 10px;
  padding: 12px 14px; color: var(--ink-text); font-size: 15px; outline: none;
  transition: border-color 0.2s var(--ease);
}
.lead-field input:focus, .lead-field select:focus { border-color: var(--phosphor); }
.lead-field--required input.invalid { border-color: var(--alert); }
.lead-error { display: none; color: var(--alert); font-size: 13px; margin-top: -4px; }
.lead-error.is-visible { display: block; }

/* =====================================================================
   TELA 3 — LOADING (impressão do cupom)
   ===================================================================== */
.screen--loading { flex-direction: column; gap: 26px; }
.printer { position: relative; width: 220px; }
.printer-slot {
  width: 100%; height: 14px; border-radius: 6px;
  background: linear-gradient(180deg, #222, #0a0a0a);
  box-shadow: inset 0 3px 6px rgba(0,0,0,0.6);
  position: relative; z-index: 2;
}
.printer-receipt {
  width: 88%; margin: 0 auto;
  background: var(--paper);
  border-radius: 0 0 8px 8px;
  padding: 16px 14px 20px;
  max-height: 0; overflow: hidden;
  animation: printOut 3s var(--ease) forwards;
  box-shadow: 0 20px 40px -12px rgba(0,0,0,0.5);
}
@keyframes printOut { to { max-height: 220px; } }
.receipt-line {
  font-family: var(--font-mono); font-size: 12px; color: var(--paper-text-dim);
  padding: 5px 0; opacity: 0;
  border-bottom: 1px dashed var(--paper-line);
  animation: lineIn 0.4s var(--ease) forwards;
}
.receipt-line:last-child { border-bottom: none; }
.receipt-line[data-delay="0"] { animation-delay: 0.3s; }
.receipt-line[data-delay="1"] { animation-delay: 0.9s; }
.receipt-line[data-delay="2"] { animation-delay: 1.5s; }
.receipt-line[data-delay="3"] { animation-delay: 2.1s; }
.receipt-line[data-delay="4"] { animation-delay: 2.7s; }
@keyframes lineIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }
.loading-caption {
  font-family: var(--font-mono); font-size: 13px; letter-spacing: 0.04em;
  color: var(--ink-text-dim);
}

/* =====================================================================
   TELA 4 — RESULTADO
   ===================================================================== */
.result-shell { width: 100%; max-width: 680px; display: flex; flex-direction: column; gap: 22px; }
.result-header { text-align: left; margin-bottom: 4px; }
.result-title { font-size: clamp(22px, 3.4vw, 28px); font-weight: 800; color: var(--ink-text); line-height: 1.3; }

/* Score card */
.score-card {
  display: flex; align-items: center; gap: 24px;
  background: linear-gradient(180deg, var(--ink-900), var(--ink-950));
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--radius-lg);
  padding: 26px 28px;
}
.score-dial { position: relative; width: 108px; height: 108px; flex-shrink: 0; }
.score-svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.score-track { fill: none; stroke: rgba(255,255,255,0.08); stroke-width: 10; }
.score-value {
  fill: none; stroke: var(--phosphor); stroke-width: 10; stroke-linecap: round;
  stroke-dasharray: 327; stroke-dashoffset: 327;
  transition: stroke-dashoffset 1.1s var(--ease), stroke 0.4s var(--ease);
}
.score-number {
  position: absolute; inset: 0; display: flex; align-items: baseline; justify-content: center; gap: 2px;
  font-family: var(--font-mono); font-weight: 700; font-size: 26px; color: var(--ink-text);
}
.score-number small { font-size: 12px; color: var(--ink-text-dim); }
.score-label-eyebrow { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.1em; color: var(--ink-text-dim); text-transform: uppercase; margin-bottom: 4px; }
.score-label { font-size: 19px; font-weight: 800; color: var(--ink-text); margin-bottom: 6px; }
.score-desc { font-size: 13px; color: var(--ink-text-dim); line-height: 1.5; }

/* Cupom de resultado */
.receipt-result { display: flex; flex-direction: column; align-items: center; }
.receipt-perf {
  width: 92%; height: 10px;
  background:
    radial-gradient(circle at 8px 0, transparent 5px, var(--paper) 5.5px) repeat-x;
  background-size: 16px 10px;
}
.receipt-perf--bottom { transform: rotate(180deg); }
.receipt-paper {
  width: 92%;
  background: var(--paper);
  color: var(--paper-text);
  padding: 26px 26px 22px;
  font-family: var(--font-mono);
}
.receipt-store { font-size: 13px; font-weight: 700; letter-spacing: 0.06em; text-align: center; }
.receipt-date { font-size: 11px; color: var(--paper-text-dim); text-align: center; margin-top: 4px; }
.receipt-divider { border-top: 1px dashed var(--paper-line); margin: 16px 0; }
.receipt-divider--dashed { border-top-style: dashed; }
.receipt-item {
  display: flex; justify-content: space-between; gap: 12px;
  font-size: 13.5px; padding: 7px 0; color: var(--paper-text);
}
.receipt-item span { color: var(--paper-text-dim); }
.receipt-total {
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: 15px; font-weight: 700; color: var(--alert);
  padding-top: 6px;
}
.receipt-total strong { font-size: 22px; }

/* Gráfico de barras */
.chart-card {
  background: linear-gradient(180deg, var(--ink-900), var(--ink-950));
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--radius-lg);
  padding: 26px 28px 22px;
}
.chart-title { font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-text-dim); margin-bottom: 18px; }
.bar-chart { display: flex; flex-direction: column; gap: 16px; }
.bar-row { display: flex; align-items: center; gap: 14px; }
.bar-row-label { width: 150px; flex-shrink: 0; font-size: 13px; color: var(--ink-text-dim); }
.bar-row-track { flex: 1; height: 12px; border-radius: 999px; background: rgba(255,255,255,0.06); overflow: hidden; }
.bar-row-fill { height: 100%; border-radius: 999px; width: 0%; transition: width 1s var(--ease); }
.bar-row-value { width: 90px; flex-shrink: 0; text-align: right; font-family: var(--font-mono); font-size: 13px; font-weight: 600; color: var(--ink-text); }

/* Recomendações */
.reco-card {
  background: linear-gradient(180deg, var(--ink-900), var(--ink-950));
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--radius-lg);
  padding: 26px 28px;
}
.reco-title { font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-text-dim); margin-bottom: 16px; }
.reco-list { display: flex; flex-direction: column; gap: 12px; }
.reco-list li {
  display: flex; gap: 10px; align-items: flex-start;
  font-size: 14.5px; line-height: 1.5; color: var(--ink-text);
}
.reco-list li::before {
  content: '▸'; color: var(--phosphor); flex-shrink: 0; font-size: 13px; margin-top: 2px;
}

/* CTA final */
.cta-final {
  text-align: center;
  background: radial-gradient(ellipse at top, rgba(51,224,138,0.14), transparent 70%), var(--ink-900);
  border: 1px solid rgba(51,224,138,0.3);
  border-radius: var(--radius-lg);
  padding: 40px 30px;
}
.cta-final h3 { font-size: 22px; font-weight: 800; color: var(--ink-text); margin-bottom: 10px; }
.cta-final p { font-size: 14px; color: var(--ink-text-dim); max-width: 42ch; margin: 0 auto 22px; line-height: 1.5; }
.cta-meta { margin-top: 14px; font-family: var(--font-mono); font-size: 11px; color: var(--ink-text-dim); }

.btn--restart { display: block; margin: 4px auto 0; }

/* ---------- Responsivo ------------------------------------------------ */
@media (max-width: 640px) {
  .terminal-body { padding: 34px 24px 30px; }
  .quiz-card { padding: 30px 22px 24px; }
  .option-grid { grid-template-columns: repeat(2, 1fr); }
  .lead-row { grid-template-columns: 1fr 90px; }
  .score-card { flex-direction: column; text-align: center; }
  .bar-row-label { width: 96px; font-size: 12px; }
  .bar-row-value { width: 76px; font-size: 12px; }
  .lead-card, .quiz-card { padding-left: 22px; padding-right: 22px; }
}
