/* Oráculo da Capivara — layout do design doc "Oraculo da Capivara.dc.html"
   Estrutura: topbar fixa · conteúdo rolável · dock sticky (CTA numa mão só).
   primary #7251F7 · secondary #42ADEF · accent #F49D19 · danger #FF4F3F · success #96C920
   mark: purple #68288C · orange #FA8104 · magenta #E90A59 · cyan #15A3DB · navy #251B42
*/
:root {
  --fy-primary: #7251f7;
  --fy-primary-dark: #5b3ee0;
  --fy-primary-light: #a08bff;
  --fy-secondary: #42adef;
  --fy-secondary-dark: #337bb7;
  --fy-tertiary: #8442ef;
  --fy-accent: #f49d19;
  --fy-accent-dark: #a1530a;
  --fy-success: #96c920;
  --fy-success-dark: #5c7a0f;
  --fy-danger: #ff4f3f;
  --fy-danger-dark: #7a0c27;

  --fy-navy: #251b42;

  --bg: #f5f4f9;
  --bg-elevated: #ffffff;
  --bg-soft: #f7f6fb;
  --ink: #1a1733;
  --ink-secondary: #52506b;
  --muted: #82809a;
  --faint: #a8a6bc;
  --line: #e6e3ee;
  --line-strong: #d5d1e4;
  --track: #f1eff7;

  --shadow-card: 0 2px 10px rgba(37, 27, 66, 0.05);
  --shadow-cta: 0 8px 20px rgba(114, 81, 247, 0.32);

  --r-card: 22px;
  --r-row: 16px;
  --r-field: 14px;
  --r-pill: 999px;

  --gutter: 20px;
  --dock-cta: 56px;

  font-family: "Roboto", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

body {
  min-height: 100dvh;
}

a {
  color: var(--fy-primary);
}

/* ---------- shell ---------- */

.shell {
  width: min(430px, 100%);
  min-height: 100dvh;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--line);
  padding: calc(12px + env(safe-area-inset-top)) var(--gutter) 10px;
}

.topbar .brand {
  display: flex;
  align-items: center;
  gap: 9px;
  font-weight: 700;
  font-size: 0.94rem;
  letter-spacing: 0.01em;
  color: var(--fy-navy);
}

.topbar .brand svg {
  width: 20px;
  height: 20px;
  display: block;
  flex: none;
}

.screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  animation: upIn 0.3s ease-out;
}

.pad {
  padding: 0 var(--gutter);
}

.pad + .pad {
  margin-top: 16px;
}

.screen > .pad:first-child {
  padding-top: 22px;
}

.dock {
  position: sticky;
  bottom: 0;
  margin-top: auto;
  padding: 18px var(--gutter) calc(26px + env(safe-area-inset-bottom));
  background: linear-gradient(180deg, rgba(245, 244, 249, 0), var(--bg) 26%);
}

/* ---------- tipografia ---------- */

.mono {
  font-family: "Roboto Mono", ui-monospace, monospace;
  font-weight: 500;
  font-size: 0.63rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.kicker {
  font-family: "Roboto Mono", ui-monospace, monospace;
  font-weight: 500;
  font-size: 0.69rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--fy-tertiary);
  margin: 0;
}

h1 {
  font-size: clamp(1.85rem, 8.6vw, 2.13rem);
  font-weight: 900;
  line-height: 1.05;
  letter-spacing: -0.02em;
  margin: 10px 0;
  color: var(--ink);
}

h2 {
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.24;
  letter-spacing: -0.01em;
  margin: 0;
  color: var(--ink);
  text-wrap: pretty;
}

h3 {
  font-size: 0.88rem;
  font-weight: 700;
  margin: 0;
  color: var(--ink);
}

p {
  margin: 0;
  color: var(--ink-secondary);
  line-height: 1.55;
}

.lede {
  font-size: 0.94rem;
  text-wrap: pretty;
}

.help {
  font-size: 0.88rem;
  color: var(--muted);
  margin-top: 8px;
  text-wrap: pretty;
}

.note {
  text-align: center;
  font-size: 0.75rem;
  line-height: 1.5;
  color: var(--muted);
  padding-top: 10px;
}

/* ---------- botões ---------- */

.btn {
  appearance: none;
  border: 0;
  width: 100%;
  height: var(--dock-cta);
  border-radius: calc(var(--dock-cta) / 2);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-family: inherit;
  font-weight: 500;
  font-size: 1.06rem;
  color: #fff;
  background: var(--fy-primary);
  box-shadow: var(--shadow-cta);
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease;
}

.btn:hover {
  background: var(--fy-primary-dark);
}

.btn:active {
  transform: translateY(1px);
}

.btn:focus-visible,
.option:focus-visible,
.link-btn:focus-visible,
.ghost:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--fy-primary) 45%, white);
  outline-offset: 2px;
}

.btn.navy {
  background: var(--fy-navy);
  box-shadow: none;
}

.btn.navy:hover {
  background: #17102c;
}

.btn.outline {
  height: 50px;
  border-radius: 25px;
  background: transparent;
  color: var(--ink-secondary);
  border: 1.5px solid var(--line);
  box-shadow: none;
  font-size: 0.94rem;
}

.ghost {
  appearance: none;
  border: 0;
  background: transparent;
  width: 100%;
  height: 46px;
  margin-top: 8px;
  color: var(--muted);
  font: 500 0.88rem/1 "Roboto", sans-serif;
  cursor: pointer;
}

.link-btn {
  appearance: none;
  border: 0;
  background: transparent;
  padding: 2px 0;
  color: var(--muted);
  font: 500 0.75rem/1 "Roboto", sans-serif;
  cursor: pointer;
}

.back {
  appearance: none;
  height: 48px;
  padding: 0 20px;
  flex: none;
  border-radius: 24px;
  border: 1.5px solid var(--line);
  background: var(--bg-elevated);
  color: var(--ink-secondary);
  font: 500 0.94rem/1 "Roboto", sans-serif;
  cursor: pointer;
}

/* ---------- intro ---------- */

.duo {
  display: flex;
  gap: 10px;
}

.capy {
  flex: 1;
  min-width: 0;
  position: relative;
  overflow: hidden;
  background: var(--bg-elevated);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 12px 12px 14px;
}

.capy::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(150, 201, 32, 0.14), rgba(150, 201, 32, 0));
}

.capy.risk::before {
  background: linear-gradient(180deg, rgba(255, 79, 63, 0.14), rgba(255, 79, 63, 0));
}

.capy img,
.capy h3,
.capy p {
  position: relative;
}

.capy img {
  display: block;
  width: 100%;
  height: 96px;
  object-fit: contain;
  animation: bob 4.4s ease-in-out infinite;
}

/* ponytail: só existe uma arte de capivara. Espelhar a do Risco evita a
   leitura de "mesma imagem duas vezes". Trocar por arte própria quando houver. */
.capy.risk img {
  animation-name: bobFlip;
  animation-delay: 0.6s;
}

.capy h3 {
  font-size: 0.81rem;
  margin-top: 8px;
  line-height: 1.2;
}

.capy p {
  font-size: 0.75rem;
  line-height: 1.4;
  color: var(--muted);
  margin-top: 2px;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip {
  font: 500 0.75rem/1 "Roboto", sans-serif;
  color: var(--ink-secondary);
  background: var(--bg-elevated);
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  padding: 8px 11px;
}

/* ---------- perguntas ---------- */

.segs {
  display: flex;
  gap: 4px;
  margin-bottom: 9px;
}

.segs i {
  flex: 1;
  height: 6px;
  border-radius: 4px;
  background: #dedaec;
  transform-origin: left;
  animation: grow 0.35s ease-out;
  transition: background 0.3s ease;
}

.segs i.done {
  background: var(--fy-primary-dark);
}

.segs i.now {
  background: var(--fy-primary);
}

.progress-meta {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.qhead {
  animation: qIn 0.28s ease-out;
}

.options {
  display: flex;
  flex-direction: column;
  gap: 9px;
  animation: qIn 0.3s ease-out;
}

.option {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 60px;
  padding: 13px 14px;
  text-align: left;
  border-radius: var(--r-row);
  border: 1.5px solid var(--line);
  background: var(--bg-elevated);
  box-shadow: 0 1px 3px rgba(37, 27, 66, 0.05);
  font-family: inherit;
  cursor: pointer;
  transition: border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}

.option .dot {
  width: 22px;
  height: 22px;
  flex: none;
  border-radius: 50%;
  border: 2px solid var(--line-strong);
  background: #fff;
  transition: border 0.18s ease;
}

.option .olabel {
  font: 400 0.94rem/1.35 "Roboto", sans-serif;
  color: var(--ink-secondary);
  text-wrap: pretty;
}

.option:hover {
  border-color: color-mix(in srgb, var(--fy-primary) 45%, var(--line));
}

.option[aria-pressed="true"] {
  border-color: var(--fy-primary);
  background: #f1edfe;
  box-shadow: 0 4px 14px rgba(114, 81, 247, 0.16);
}

.option[aria-pressed="true"] .dot {
  border: 7px solid var(--fy-primary);
}

.option[aria-pressed="true"] .olabel {
  font-weight: 500;
  color: var(--ink);
}

.dock.split {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 14px;
}

.dock.split .hint {
  font-size: 0.75rem;
  line-height: 1.4;
  color: var(--faint);
  text-align: right;
}

/* ---------- resultado ---------- */

.hero {
  padding: 20px var(--gutter) 22px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(170deg, #e9e4fe, #f4f1fe 62%, var(--bg));
}

.hero[data-tone="risk"] {
  background: linear-gradient(170deg, #ffe9e6, #fff6f4 62%, var(--bg));
}

.hero[data-tone="good"] {
  background: linear-gradient(170deg, #eef7dc, #f7fbee 62%, var(--bg));
}

.hero[data-tone="info"] {
  background: linear-gradient(170deg, #e4f1fa, #f1f8fc 62%, var(--bg));
}

.hero .kicker {
  color: var(--fy-primary-dark);
}

.hero[data-tone="risk"] .kicker {
  color: var(--fy-danger-dark);
}

.hero[data-tone="good"] .kicker {
  color: var(--fy-success-dark);
}

.hero[data-tone="info"] .kicker {
  color: var(--fy-secondary-dark);
}

.hero-top {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.hero-top > div {
  flex: 1;
  min-width: 0;
}

.hero-top h2 {
  font-size: 1.69rem;
  font-weight: 900;
  line-height: 1.1;
  letter-spacing: -0.02em;
  margin-top: 8px;
}

.hero-art {
  width: 108px;
  height: 108px;
  flex: none;
  margin: -6px -4px 0 0;
  background: url("./assets/capivara.png") center/contain no-repeat;
  animation: popIn 0.4s ease-out;
}

.hero .lede {
  margin-top: 12px;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 14px;
}

.tag {
  font-family: "Roboto Mono", ui-monospace, monospace;
  font-weight: 500;
  font-size: 0.69rem;
  letter-spacing: 0.04em;
  color: var(--ink-secondary);
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(26, 23, 51, 0.08);
  border-radius: var(--r-pill);
  padding: 7px 10px;
}

.panel {
  background: var(--bg-elevated);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  padding: 18px 16px;
  box-shadow: var(--shadow-card);
}

.panel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}

.panel-head .mono {
  color: var(--faint);
}

.meters {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.meter-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 6px;
}

.meter-top span {
  font: 500 0.81rem/1.2 "Roboto", sans-serif;
  color: var(--ink);
}

.meter-top b {
  font: 700 0.94rem/1 "Roboto", sans-serif;
  color: var(--c, var(--fy-primary));
}

.track {
  height: 10px;
  border-radius: 6px;
  background: var(--track);
  overflow: hidden;
}

.track i {
  display: block;
  height: 100%;
  border-radius: 6px;
  background: var(--c, var(--fy-primary));
  transform-origin: left;
  animation: grow 0.7s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.meter .hint {
  font-size: 0.75rem;
  line-height: 1.45;
  color: var(--muted);
  margin-top: 5px;
}

.staff {
  border: 1px dashed #c9c4dd;
  border-radius: 20px;
  background: #fbfafe;
  padding: 15px 16px;
}

.staff-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.staff-head .kicker {
  font-size: 0.63rem;
}

.staff-body {
  margin-top: 11px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  animation: upIn 0.22s ease-out;
}

.staff-body .pitch {
  font-size: 0.88rem;
  line-height: 1.5;
  color: var(--ink);
  text-wrap: pretty;
}

.next-row {
  display: flex;
  align-items: center;
  gap: 9px;
  background: var(--bg-elevated);
  border: 1px solid var(--line);
  border-radius: var(--r-field);
  padding: 11px 12px;
}

.badge {
  width: 22px;
  height: 22px;
  flex: none;
  border-radius: 8px;
  text-align: center;
  font: 700 0.75rem/22px "Roboto", sans-serif;
  color: #fff;
  background: var(--fy-accent);
}

.badge.good {
  background: #edf7da;
  color: var(--fy-success-dark);
}

.badge.purple {
  background: #ede8fe;
  color: var(--fy-primary);
}

.next-row span:last-child {
  font: 500 0.81rem/1.4 "Roboto", sans-serif;
  color: var(--ink);
}

/* ---------- lead ---------- */

.fields {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

label {
  display: block;
}

label > span {
  display: block;
  font: 500 0.75rem/1 "Roboto", sans-serif;
  color: var(--ink-secondary);
  margin-bottom: 6px;
}

input {
  width: 100%;
  height: 52px;
  padding: 0 14px;
  border-radius: var(--r-field);
  border: 1.5px solid var(--line);
  background: var(--bg-elevated);
  color: var(--ink);
  font: 400 1rem/1 "Roboto", sans-serif;
  outline: none;
}

input:focus-visible {
  border-color: var(--fy-primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--fy-primary) 22%, transparent);
}

input[aria-invalid="true"] {
  border-color: var(--fy-danger);
  background: #fff8f7;
}

.consent {
  display: grid;
  grid-template-columns: 20px 1fr;
  align-items: start;
  gap: 10px;
  font-size: 0.78rem;
  line-height: 1.45;
  color: var(--ink-secondary);
}

.consent input {
  width: 18px;
  height: 18px;
  margin: 2px 0 0;
  padding: 0;
}

.error {
  background: #fff1ef;
  border: 1px solid rgba(255, 79, 63, 0.3);
  border-radius: var(--r-field);
  padding: 12px 13px;
  font-size: 0.81rem;
  line-height: 1.45;
  color: var(--fy-danger-dark);
  animation: popIn 0.2s ease-out;
}

/* ---------- obrigado ---------- */

.thanks-art {
  position: relative;
  width: 196px;
  margin: 0 auto;
  animation: popIn 0.38s ease-out;
}

.thanks-art::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 52%;
  transform: translate(-50%, -50%);
  width: 150px;
  height: 150px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(150, 201, 32, 0.26), rgba(150, 201, 32, 0) 70%);
}

.thanks-art img {
  position: relative;
  display: block;
  width: 196px;
  height: 150px;
  object-fit: contain;
  animation: bob 4.6s ease-in-out infinite;
}

.thanks-art .check {
  position: absolute;
  right: 6px;
  bottom: 2px;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--fy-success);
  border: 3px solid var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 14px rgba(150, 201, 32, 0.35);
}

.center {
  text-align: center;
}

.center h2 {
  font-size: 1.63rem;
  line-height: 1.18;
  margin: 16px 0 8px;
}

.staff-card {
  background: var(--fy-navy);
  border-radius: 20px;
  padding: 16px 16px 14px;
}

.staff-card .mono {
  color: var(--fy-primary-light);
}

.live {
  display: flex;
  align-items: center;
  gap: 8px;
}

.live .dot {
  width: 8px;
  height: 8px;
  flex: none;
  border-radius: 50%;
  background: var(--fy-success);
  animation: pulse 1.8s ease-out infinite;
}

.staff-card .line {
  font: 500 0.94rem/1.45 "Roboto", sans-serif;
  color: #fff;
  margin-top: 11px;
  text-wrap: pretty;
}

.staff-card .sub {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 13px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: var(--r-field);
  padding: 10px 12px;
}

.staff-card .sub span:last-child {
  font: 400 0.81rem/1.4 "Roboto", sans-serif;
  color: #e7e3f2;
}

.staff-card .badge {
  width: 26px;
  height: 26px;
  line-height: 26px;
  background: var(--fy-success);
  color: var(--fy-navy);
}

.facts {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.fact {
  display: flex;
  gap: 11px;
  align-items: flex-start;
  background: var(--bg-elevated);
  border: 1px solid var(--line);
  border-radius: var(--r-row);
  padding: 13px 14px;
}

.fact span:last-child {
  font: 400 0.88rem/1.45 "Roboto", sans-serif;
  color: var(--ink);
}

/* ---------- estados de carga/falha ---------- */

.skeleton {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 26px var(--gutter);
}

.skeleton i {
  display: block;
  border-radius: 10px;
  background: linear-gradient(90deg, #edebf4 0%, #f8f7fc 40%, #edebf4 80%);
  background-size: 260px 100%;
  animation: shimmer 1.1s linear infinite;
}

.spinner {
  width: 17px;
  height: 17px;
  flex: none;
  border-radius: 50%;
  border: 2.5px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  animation: spin 0.7s linear infinite;
}

/* ---------- animações ---------- */

@keyframes shimmer {
  0% {
    background-position: -260px 0;
  }
  100% {
    background-position: 260px 0;
  }
}
@keyframes qIn {
  from {
    opacity: 0;
    transform: translateX(22px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@keyframes upIn {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@keyframes popIn {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@keyframes grow {
  from {
    transform: scaleX(0);
  }
  to {
    transform: scaleX(1);
  }
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(150, 201, 32, 0.55);
  }
  70% {
    box-shadow: 0 0 0 10px rgba(150, 201, 32, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(150, 201, 32, 0);
  }
}
@keyframes bob {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-6px);
  }
}
@keyframes bobFlip {
  0%,
  100% {
    transform: scaleX(-1) translateY(0);
  }
  50% {
    transform: scaleX(-1) translateY(-6px);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before {
    animation: none !important;
    transition: none !important;
  }
  /* sem animação o espelhamento some junto; mantém pelo transform */
  .capy.risk img {
    transform: scaleX(-1);
  }
}
