:root {
  --bg: #fbf8ff;
  --ink: #1d1530;
  --muted: #6b6384;
  --card: rgba(255, 255, 255, 0.82);
  --line: rgba(124, 58, 237, 0.16);
  --brand: #7c3aed;
  --brand-2: #ff6a3d;
  --teal: #14b8a6;
  --ok: #16a34a;
  --warn: #d97706;
  --bad: #dc2626;
  --radius: 22px;
  --shadow: 0 18px 50px -20px rgba(124, 58, 237, 0.35), 0 2px 8px rgba(29, 21, 48, 0.06);
  --font: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #130d22;
    --ink: #f4efff;
    --muted: #b3a9cf;
    --card: rgba(31, 22, 54, 0.8);
    --line: rgba(167, 139, 250, 0.22);
    --shadow: 0 18px 50px -20px rgba(0, 0, 0, 0.7);
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; font-family: var(--font); color: var(--ink); background: var(--bg);
  line-height: 1.5; overflow-x: hidden;
}
[hidden] { display: none !important; }

/* fundo aurora */
.aurora { position: fixed; inset: 0; z-index: -1; overflow: hidden; }
.aurora span { position: absolute; width: 55vmax; height: 55vmax; border-radius: 50%; filter: blur(90px); opacity: 0.45; animation: drift 22s ease-in-out infinite alternate; }
.aurora span:nth-child(1) { background: #ff8a5c; top: -20vmax; left: -15vmax; }
.aurora span:nth-child(2) { background: #8b5cf6; bottom: -25vmax; right: -15vmax; animation-delay: -7s; }
.aurora span:nth-child(3) { background: #2dd4bf; top: 30%; left: 35%; width: 30vmax; height: 30vmax; opacity: 0.3; animation-delay: -12s; }
@keyframes drift { to { transform: translate(6vmax, 4vmax) scale(1.12); } }

.shell { width: min(720px, 100% - 32px); margin: 0 auto; padding: max(18px, env(safe-area-inset-top)) 0 40px; }
.topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand strong { font-size: 1.15rem; letter-spacing: 0.08em; display: block; line-height: 1.1; }
.brand small { color: var(--muted); font-size: 0.78rem; }
.logo { width: 44px; height: 44px; filter: drop-shadow(0 6px 10px rgba(124, 58, 237, 0.35)); }

.card {
  background: var(--card); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 24px; margin-bottom: 16px; animation: rise 0.5s ease both;
}
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }

h1 { font-size: clamp(1.7rem, 5.5vw, 2.3rem); line-height: 1.15; margin: 8px 0 10px; }
h2 { font-size: 1.35rem; margin: 0 0 4px; }
h3 { font-size: 1.05rem; margin: 0; }
.grad { background: linear-gradient(90deg, var(--brand-2), var(--brand)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.lead { font-size: 1.05rem; color: var(--muted); margin: 0 0 20px; }
.muted { color: var(--muted); margin: 0 0 18px; }
.tiny { font-size: 0.78rem; color: var(--muted); }
.center { text-align: center; margin-top: 24px; }
.foot { margin: 18px 0 0; font-size: 0.82rem; color: var(--muted); text-align: center; }

/* hero */
.hero { text-align: center; padding-top: 32px; }
.hero-art { position: relative; height: 96px; margin-bottom: 6px; }
.bubble { position: absolute; padding: 8px 14px; border-radius: 999px; font-size: 0.82rem; font-weight: 600; color: #fff; box-shadow: 0 10px 20px -8px rgba(0,0,0,.35); animation: float 5s ease-in-out infinite; }
.b1 { left: 4%; top: 30px; background: linear-gradient(135deg, #14b8a6, #0ea5e9); }
.b2 { left: 50%; top: 0; translate: -50% 0; background: linear-gradient(135deg, #ff6a3d, #f43f5e); animation-delay: -1.5s; }
.b3 { right: 4%; top: 42px; background: linear-gradient(135deg, #7c3aed, #c026d3); animation-delay: -3s; }
@keyframes float { 50% { transform: translateY(-9px); } }

/* formulários */
.stack { display: grid; gap: 10px; text-align: left; }
label { font-weight: 650; font-size: 0.92rem; }
.req, .opt { font-weight: 500; font-size: 0.74rem; padding: 2px 8px; border-radius: 999px; margin-left: 6px; }
.req { background: rgba(255, 106, 61, 0.15); color: #c2410c; }
.opt { background: rgba(124, 58, 237, 0.12); color: var(--brand); }
@media (prefers-color-scheme: dark) { .req { color: #fdba74; } .opt { color: #c4b5fd; } }

input[type="text"], input[type="password"], textarea {
  width: 100%; font: inherit; color: var(--ink); background: rgba(255,255,255,.6);
  border: 1.5px solid var(--line); border-radius: 14px; padding: 13px 14px; outline: none;
  transition: border-color .2s, box-shadow .2s, transform .2s;
}
@media (prefers-color-scheme: dark) { input[type="text"], input[type="password"], textarea { background: rgba(255,255,255,.06); } }
input:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.18); }
textarea { resize: vertical; min-height: 84px; }
.field { position: relative; }
.field input { padding-right: 52px; }
.icon-btn { position: absolute; right: 6px; top: 50%; translate: 0 -50%; border: 0; background: transparent; font-size: 1.1rem; cursor: pointer; padding: 8px 10px; border-radius: 10px; }
.counter { text-align: right; font-size: 0.74rem; color: var(--muted); margin-top: -6px; }

/* botões */
button { font: inherit; cursor: pointer; }
.primary {
  position: relative; border: 0; color: #fff; font-weight: 700; padding: 14px 22px; border-radius: 16px;
  background: linear-gradient(120deg, var(--brand-2), #f43f5e 40%, var(--brand));
  background-size: 160% 100%; box-shadow: 0 14px 28px -12px rgba(244, 63, 94, 0.7);
  transition: transform .18s ease, box-shadow .18s ease, background-position .4s ease;
}
.primary:hover { transform: translateY(-2px); background-position: 100% 0; }
.primary:active { transform: translateY(0) scale(.98); }
.primary.big { padding: 17px 22px; font-size: 1.05rem; margin-top: 6px; }
.ghost { background: transparent; color: var(--brand); border: 1.5px solid var(--line); padding: 12px 18px; border-radius: 14px; font-weight: 650; transition: background .2s, transform .18s; }
.ghost:hover { background: rgba(124, 58, 237, 0.1); transform: translateY(-1px); }
.ghost.small { padding: 8px 14px; font-size: 0.85rem; }
button:focus-visible, .drop:focus-visible { outline: 3px solid var(--teal); outline-offset: 2px; }
button[disabled] { opacity: .7; cursor: progress; transform: none; }
.spinner { display: none; width: 18px; height: 18px; border: 3px solid rgba(255,255,255,.5); border-top-color: #fff; border-radius: 50%; animation: spin .8s linear infinite; margin-left: 10px; vertical-align: -3px; }
button.busy .spinner { display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* upload */
.drop { display: grid; place-items: center; gap: 6px; text-align: center; padding: 22px 14px; border: 2px dashed rgba(124, 58, 237, 0.4); border-radius: 18px; color: var(--muted); cursor: pointer; transition: background .2s, border-color .2s, transform .2s; }
.drop:hover, .drop.over { background: rgba(124, 58, 237, 0.08); border-color: var(--brand); transform: scale(1.01); }
.drop-ico { font-size: 1.7rem; }
.previews { list-style: none; padding: 0; margin: 0; display: flex; gap: 10px; flex-wrap: wrap; }
.previews li { position: relative; width: 84px; height: 84px; border-radius: 14px; overflow: hidden; border: 1px solid var(--line); animation: rise .3s ease both; }
.previews img { width: 100%; height: 100%; object-fit: cover; display: block; }
.previews button { position: absolute; top: 4px; right: 4px; width: 24px; height: 24px; border-radius: 50%; border: 0; background: rgba(0,0,0,.65); color: #fff; line-height: 1; }

/* mensagens */
.msg { margin: 4px 0 0; padding: 12px 14px; border-radius: 14px; font-size: 0.92rem; }
.msg.erro { background: rgba(220, 38, 38, 0.1); color: var(--bad); border: 1px solid rgba(220, 38, 38, 0.3); }
@media (prefers-color-scheme: dark) { .msg.erro { color: #fca5a5; } }

/* carregamento */
.loading { text-align: center; }
.orb { width: 64px; height: 64px; margin: 0 auto 12px; border-radius: 50%; background: conic-gradient(from 0deg, #ff6a3d, #7c3aed, #14b8a6, #ff6a3d); animation: spin 1.6s linear infinite; mask: radial-gradient(circle 20px at center, transparent 98%, #000 100%); -webkit-mask: radial-gradient(circle 20px at center, transparent 98%, #000 100%); }
.steps { list-style: none; padding: 0; margin: 14px auto 0; max-width: 340px; text-align: left; display: grid; gap: 8px; color: var(--muted); }
.steps li { padding-left: 28px; position: relative; opacity: .45; transition: opacity .4s, color .4s; }
.steps li::before { content: "○"; position: absolute; left: 4px; }
.steps li.on { opacity: 1; color: var(--ink); font-weight: 600; }
.steps li.on::before { content: "●"; color: var(--brand-2); animation: pulse 1s ease-in-out infinite; }
.steps li.done { opacity: 1; }
.steps li.done::before { content: "✓"; color: var(--ok); }
@keyframes pulse { 50% { transform: scale(1.4); } }

/* resultados */
.result-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.badge { font-size: 0.78rem; font-weight: 700; padding: 5px 11px; border-radius: 999px; background: rgba(22, 163, 74, 0.14); color: var(--ok); }
.badge.warn { background: rgba(217, 119, 6, 0.16); color: var(--warn); }
.legenda { font-size: 1.05rem; font-weight: 600; background: rgba(124,58,237,.07); border: 1px solid var(--line); border-radius: 14px; padding: 14px; margin: 0 0 12px; word-break: break-word; }
.headlines { list-style: none; counter-reset: h; margin: 0; padding: 0; display: grid; gap: 10px; }
.headlines li { counter-increment: h; display: grid; grid-template-columns: 34px 1fr auto; gap: 10px; align-items: center; padding: 12px; border-radius: 16px; background: rgba(255,255,255,.5); border: 1px solid var(--line); animation: rise .45s ease both; animation-delay: calc(var(--i, 0) * 80ms); }
@media (prefers-color-scheme: dark) { .headlines li { background: rgba(255,255,255,.05); } }
.headlines li::before { content: counter(h); width: 30px; height: 30px; display: grid; place-items: center; border-radius: 10px; color: #fff; font-weight: 800; background: linear-gradient(135deg, var(--brand-2), var(--brand)); }
.headlines p { margin: 0; font-weight: 600; word-break: break-word; }
.alerta { border-color: rgba(217, 119, 6, 0.5); background: linear-gradient(0deg, rgba(251, 191, 36, 0.12), rgba(251, 191, 36, 0.12)), var(--card); }
.alerta p { margin: 8px 0 0; }
.note { font-size: 0.9rem; color: var(--muted); }
.actions { display: flex; gap: 12px; flex-wrap: wrap; margin: 4px 0 6px; }
.actions > * { flex: 1 1 200px; }

.toast { position: fixed; left: 50%; bottom: max(24px, env(safe-area-inset-bottom)); translate: -50% 0; background: #1d1530; color: #fff; padding: 11px 18px; border-radius: 999px; font-size: 0.9rem; box-shadow: 0 12px 30px rgba(0,0,0,.35); animation: rise .25s ease both; z-index: 10; }

@media (max-width: 480px) {
  .card { padding: 18px; border-radius: 18px; }
  .headlines li { grid-template-columns: 30px 1fr; }
  .headlines li .ghost { grid-column: 2; justify-self: start; }
  .bubble { font-size: 0.72rem; padding: 6px 10px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

.sr-copy { position: fixed; left: -9999px; top: 0; opacity: 0; }
