:root {
  --bg: #0a0710;
  --bg2: #140d1f;
  --card: rgba(255, 255, 255, .045);
  --line: rgba(255, 255, 255, .1);
  --ink: #f4eefb;
  --mute: #a99bbd;
  --lilac: #c9a7ff;
  --peach: #ffb48a;
  --gold: #f5c96b;
  --vida: #8cffb4;
  --cabeca: #7cc8ff;
  --coracao: #ff6f9c;
  --destino: #f5c96b;
  --iri: linear-gradient(100deg, #c9a7ff 0%, #ffb48a 55%, #f5c96b 100%);
  --r: 22px;
  --serif: 'Instrument Serif', Georgia, serif;
  --sans: 'DM Sans', system-ui, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, monospace;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  background: radial-gradient(120% 70% at 50% -10%, #2a1740 0%, var(--bg) 60%) fixed, var(--bg);
  color: var(--ink);
  font: 16px/1.5 var(--sans);
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
.mono { font-family: var(--mono); letter-spacing: .02em; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.iri { background: var(--iri); -webkit-background-clip: text; background-clip: text; color: transparent; }

.stars {
  position: fixed; inset: 0; pointer-events: none; z-index: 0; opacity: .55;
  background-image:
    radial-gradient(1px 1px at 12% 18%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 78% 12%, #fff 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 62% 42%, #e7d8ff 50%, transparent 51%),
    radial-gradient(1px 1px at 30% 70%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 88% 78%, #fff 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 8% 90%, #ffe3c2 50%, transparent 51%),
    radial-gradient(1px 1px at 46% 8%, #fff 50%, transparent 51%);
  animation: twinkle 6s ease-in-out infinite alternate;
}
@keyframes twinkle { to { opacity: .25; } }

/* topo */
.top {
  position: fixed; top: 0; left: 0; right: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(env(safe-area-inset-top) + 14px) 20px 14px;
  background: linear-gradient(180deg, rgba(10, 7, 16, .92) 0%, rgba(10, 7, 16, .7) 70%, rgba(10, 7, 16, 0) 100%);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.logo { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font: 26px/1 var(--serif); }
.lang { display: flex; gap: 4px; padding: 4px; border: 1px solid var(--line); border-radius: 999px; background: rgba(10, 7, 16, .6); backdrop-filter: blur(10px); }
.lang button { border: 0; background: none; padding: 6px 12px; border-radius: 999px; font: 700 12px/1 var(--mono); color: var(--mute); }
.lang button.is-on { background: var(--ink); color: var(--bg); }

main { position: relative; z-index: 1; }
.screen { display: none; min-height: 100dvh; }
.screen.is-on { display: flex; animation: fadeIn .45s ease both; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } }

/* botões */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 56px; padding: 0 28px; border-radius: 999px; border: 0;
  font-weight: 700; font-size: 17px; text-decoration: none; transition: transform .15s ease, opacity .15s;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .5; }
.btn-main { background: var(--iri); color: #1a0f24; box-shadow: 0 10px 40px -10px rgba(255, 180, 138, .55); }
.btn-ghost { background: var(--card); border: 1px solid var(--line); color: var(--ink); }
.link-btn { background: none; border: 0; color: var(--mute); text-decoration: underline; text-underline-offset: 4px; padding: 10px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }
.row > .btn { flex: 1 1 160px; }

/* 1. entrada */
.screen-home { align-items: center; justify-content: center; padding: 96px 20px 40px; }
.home-inner { width: 100%; max-width: 520px; text-align: center; display: flex; flex-direction: column; align-items: center; }
.kicker { font-size: 12px; text-transform: uppercase; letter-spacing: .14em; color: var(--mute); margin: 0 0 18px; }
.hero { font: 400 clamp(52px, 14vw, 88px)/.95 var(--serif); margin: 0 0 20px; letter-spacing: -.01em; }
.hero em { font-style: italic; }
.lead { color: var(--mute); font-size: 17px; max-width: 400px; margin: 0 0 28px; }
.home-hand { position: relative; width: 200px; height: 236px; margin: 0 0 32px; }
.hand-art { width: 100%; height: 100%; overflow: visible; }
.hand-outline { fill: rgba(201, 167, 255, .06); stroke: rgba(201, 167, 255, .45); stroke-width: 1.4; }
.hl { fill: none; stroke-width: 2.6; stroke-linecap: round; stroke-dasharray: 160; stroke-dashoffset: 160; animation: draw 5s ease-in-out infinite; filter: drop-shadow(0 0 6px currentColor); }
.hl-coracao { stroke: var(--coracao); color: var(--coracao); }
.hl-cabeca { stroke: var(--cabeca); color: var(--cabeca); animation-delay: .4s; }
.hl-vida { stroke: var(--vida); color: var(--vida); animation-delay: .8s; }
.hl-destino { stroke: var(--destino); color: var(--destino); animation-delay: 1.2s; }
@keyframes draw { 0%, 12% { stroke-dashoffset: 160; } 45%, 80% { stroke-dashoffset: 0; } 100% { stroke-dashoffset: 160; opacity: 0; } }
.scanbar { position: absolute; left: -10%; right: -10%; height: 2px; top: 0; background: linear-gradient(90deg, transparent, var(--peach), transparent); box-shadow: 0 0 18px 4px rgba(255, 180, 138, .45); animation: scan 3.2s ease-in-out infinite; }
@keyframes scan { 0%, 100% { top: 4%; } 50% { top: 92%; } }
.counter { margin: 18px 0 0; font-size: 13px; color: var(--gold); }
.privacy { display: flex; align-items: center; gap: 8px; margin: 14px 0 0; font-size: 13px; color: var(--mute); }

/* 2. câmara */
.screen-cam { flex-direction: column; align-items: center; padding: calc(env(safe-area-inset-top) + 72px) 16px calc(env(safe-area-inset-bottom) + 16px); gap: 16px; }
.cam-wrap { position: relative; width: 100%; max-width: 480px; aspect-ratio: 3 / 4; border-radius: var(--r); overflow: hidden; background: #000; border: 1px solid var(--line); }
.cam-wrap video, .cam-fx { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.cam-wrap.mirror video, .cam-wrap.mirror .cam-fx { transform: scaleX(-1); }
.cam-guide { position: absolute; left: 50%; top: 52%; width: 64%; transform: translate(-50%, -50%); fill: none; stroke: rgba(255, 255, 255, .55); stroke-width: 1.4; stroke-dasharray: 5 6; transition: opacity .3s, stroke .3s; }
.cam-wrap.found .cam-guide { opacity: .15; }
.cam-status { position: absolute; left: 50%; top: 16px; transform: translateX(-50%); padding: 8px 14px; border-radius: 999px; background: rgba(10, 7, 16, .7); backdrop-filter: blur(8px); font-size: 12px; white-space: nowrap; }
.cam-wrap.found .cam-status { color: var(--vida); }
.cam-ring { position: absolute; left: 50%; bottom: 18px; width: 54px; height: 54px; transform: translateX(-50%); opacity: 0; transition: opacity .2s; }
.cam-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.cam-ring circle { fill: none; stroke: var(--vida); stroke-width: 6; stroke-dasharray: 289; stroke-dashoffset: 289; stroke-linecap: round; }
.cam-wrap.found .cam-ring { opacity: 1; }
.cam-bar { display: flex; align-items: center; justify-content: space-between; width: 100%; max-width: 320px; }
.icon-btn { width: 52px; height: 52px; display: grid; place-items: center; border-radius: 50%; background: var(--card); border: 1px solid var(--line); cursor: pointer; }
.shutter { width: 78px; height: 78px; border-radius: 50%; border: 3px solid var(--ink); background: none; padding: 5px; }
.shutter span { display: block; width: 100%; height: 100%; border-radius: 50%; background: var(--iri); transition: transform .15s; }
.shutter:disabled { opacity: .35; }
.shutter:active span { transform: scale(.88); }
.cam-tip { margin: 0; color: var(--mute); font-size: 14px; text-align: center; max-width: 360px; }

/* 3. scan */
.screen-scan { flex-direction: column; align-items: center; justify-content: center; padding: 88px 16px 40px; gap: 22px; }
.stage { position: relative; width: 100%; max-width: 440px; border-radius: var(--r); overflow: hidden; border: 1px solid var(--line); background: #000; }
.stage img { display: block; width: 100%; height: auto; }
.stage canvas, .stage svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.screen-scan .stage img { filter: saturate(.6) contrast(1.1) brightness(.8); }
.laser { position: absolute; left: 0; right: 0; height: 3px; background: linear-gradient(90deg, transparent, var(--peach), #fff, var(--peach), transparent); box-shadow: 0 0 24px 8px rgba(255, 180, 138, .5); animation: scan 2.4s ease-in-out infinite; }
.scan-text { min-height: 1.5em; margin: 0; font-size: 14px; color: var(--gold); text-align: center; }
.scan-progress { width: 100%; max-width: 280px; height: 4px; border-radius: 4px; background: var(--line); overflow: hidden; }
.scan-progress span { display: block; height: 100%; width: 0; background: var(--iri); transition: width .4s ease; }

/* 4. resultado */
.screen-result { justify-content: center; padding: 88px 16px 48px; }
.result-inner { width: 100%; max-width: 520px; display: flex; flex-direction: column; gap: 16px; }
.stage-result { max-width: none; }
.res-lines path { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.res-lines text { font: 700 13px var(--mono); paint-order: stroke; stroke: rgba(10, 7, 16, .85); stroke-width: 4px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 22px 20px; }
.card p { margin: 0; }
.card-title { font: 400 28px/1.1 var(--serif); margin: 0 0 16px; }
.card-type { text-align: center; padding: 30px 20px; background: linear-gradient(180deg, rgba(201, 167, 255, .1), rgba(255, 180, 138, .04)); }
.card-type .kicker { margin-bottom: 10px; }
.type-name { font: italic 400 clamp(38px, 10vw, 52px)/1 var(--serif); margin: 0 0 18px; }
.type-meta { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin: 0 0 18px; }
.pill { font: 700 12px/1 var(--mono); padding: 8px 12px; border-radius: 999px; border: 1px solid var(--line); text-transform: uppercase; letter-spacing: .06em; }
.pill-gold { color: var(--gold); border-color: rgba(245, 201, 107, .4); }
.hook { font-size: 18px; }
.bars { display: grid; gap: 14px; }
.bar-row { display: grid; grid-template-columns: 92px 1fr 40px; align-items: center; gap: 12px; font-size: 14px; }
.bar-row .track { height: 8px; border-radius: 8px; background: var(--line); overflow: hidden; }
.bar-row .fill { height: 100%; width: 0; border-radius: 8px; background: var(--iri); transition: width 1.2s cubic-bezier(.2, .8, .2, 1); }
.bar-row b { font: 700 13px var(--mono); text-align: right; }
.lines-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 18px; }
.lines-list li { display: grid; grid-template-columns: 12px 1fr; gap: 14px; }
.lines-list .dot { width: 12px; height: 12px; border-radius: 50%; margin-top: 6px; box-shadow: 0 0 10px currentColor; background: currentColor; }
.lines-list h4 { margin: 0 0 4px; font-size: 15px; }
.lines-list h4 small { font: 500 12px var(--mono); color: var(--mute); margin-left: 8px; }
.lines-list p { color: var(--mute); font-size: 15px; }
.preds { margin: 0; padding: 0; list-style: none; counter-reset: p; display: grid; gap: 14px; }
.preds li { counter-increment: p; display: grid; grid-template-columns: 34px 1fr; gap: 12px; align-items: start; }
.preds li::before { content: '0' counter(p); font: 700 13px/1 var(--mono); color: var(--gold); padding-top: 4px; }
.flags { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.flag p.mono { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; margin-bottom: 10px; }
.flag-green p.mono { color: var(--vida); }
.flag-red p.mono { color: var(--coracao); }
.share-box { display: flex; flex-direction: column; gap: 12px; align-items: stretch; margin-top: 8px; }
.vid-progress { position: relative; height: 44px; border-radius: 999px; background: var(--card); border: 1px solid var(--line); overflow: hidden; display: grid; place-items: center; }
.vid-progress span { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: rgba(201, 167, 255, .25); transition: width .2s linear; }
.vid-progress em { position: relative; font-style: normal; font-size: 13px; }
.disclaimer { color: var(--mute); font-size: 12px; text-align: center; margin: 8px 0 0; }

/* toast e modal */
.toast { position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 24px); transform: translate(-50%, 30px); opacity: 0; z-index: 50; background: var(--ink); color: var(--bg); padding: 12px 18px; border-radius: 14px; font-weight: 500; font-size: 14px; max-width: calc(100% - 32px); text-align: center; transition: .25s ease; pointer-events: none; }
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }
.modal { position: fixed; inset: 0; z-index: 40; background: rgba(5, 3, 8, .85); backdrop-filter: blur(10px); display: grid; place-items: center; padding: 16px; }
.modal[hidden] { display: none; }
.modal-box { width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 14px; align-items: stretch; text-align: center; }
.modal-box video { width: 100%; max-height: 62dvh; aspect-ratio: 9 / 16; object-fit: contain; border-radius: var(--r); background: #000; border: 1px solid var(--line); }
.modal-tip { margin: 0; color: var(--mute); font-size: 14px; }

@media (min-width: 900px) {
  .result-inner { max-width: 980px; display: grid; grid-template-columns: 1fr 1fr; align-items: start; }
  .stage-result { grid-row: span 3; position: sticky; top: 88px; }
  .result-inner > .card-type { grid-column: 2; }
  .share-box, .disclaimer { grid-column: 1 / -1; max-width: 520px; justify-self: center; width: 100%; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; } }
