*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--surface-100);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 24px;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
}
main { flex: 1; width: 100%; max-width: 480px; margin: 0 auto; padding: 0 var(--space-5); }
p { margin: 0; }
.muted { color: var(--ink-muted); }
.soft { color: var(--surface-200); }
.sand { color: var(--accent-sand) !important; }
.eyebrow { color: var(--accent-caramel); display: block; }
h1 { margin: 0; }

.top {
  display: flex; justify-content: center;
  padding: var(--space-6) var(--space-5) var(--space-5);
  border-bottom: 1px solid var(--hairline);
}
.logo { height: 44px; width: auto; }

.intro { text-align: center; padding: var(--space-8) 0 var(--space-6); }
.intro .h1 { margin: 12px 0 14px; font-size: 38px; }
.intro .lead { max-width: 340px; margin: 0 auto; }

/* ---------- Roleta ---------- */
.wheel-wrap { display: flex; justify-content: center; padding-bottom: var(--space-8); }
.wheel { position: relative; width: min(100%, 360px); aspect-ratio: 1; }
.wheel canvas { width: 100%; height: 100%; display: block; }
.pointer {
  position: absolute; top: -6px; left: 50%; width: 26px; height: 32px;
  transform: translateX(-50%); z-index: 2; fill: var(--surface-espresso);
}
.hub {
  position: absolute; top: 50%; left: 50%; width: 22%; aspect-ratio: 1;
  transform: translate(-50%, -50%); border-radius: var(--radius-full);
  background: var(--surface-paper); border: 1px solid var(--hairline);
  display: flex; align-items: center; justify-content: center;
}
.hub img { width: 52%; height: auto; }

/* ---------- Formulário ---------- */
.panel { border-top: 1px solid var(--hairline); padding: var(--space-8) 0 var(--space-12); }
form { display: grid; gap: var(--space-5); }
.field { display: grid; gap: 8px; }
.field input {
  height: 48px; width: 100%; padding: 0 14px;
  font: 400 16px/1 var(--font-sans); color: var(--ink);
  background: var(--surface-paper); border: 1px solid var(--hairline);
  border-radius: var(--radius-none); outline: none; -webkit-appearance: none;
}
.field input::placeholder { color: #a8927f; }
.field input:focus { border-color: var(--accent-caramel); box-shadow: 0 0 0 1px var(--accent-caramel); }
.field input[aria-invalid="true"] { border-color: var(--danger); }
.consent { display: flex; gap: 12px; align-items: flex-start; color: var(--ink-soft); cursor: pointer; }
.consent input { margin: 3px 0 0; width: 18px; height: 18px; flex: none; accent-color: var(--surface-deep); }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.error { color: var(--danger); }

.btn {
  height: 48px; padding: 0 var(--space-6); width: 100%;
  background: var(--brand); color: var(--brand-foreground);
  border: 0; border-radius: var(--radius-none); cursor: pointer;
  font: 700 11px/15px var(--font-sans); letter-spacing: 0.2em; text-transform: uppercase;
  transition: background .2s;
}
.btn:hover { background: var(--surface-espresso); }
.btn:disabled { opacity: .55; cursor: default; }
.btn:focus-visible, .consent input:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }

/* ---------- Resultado ---------- */
.result {
  margin: 0 calc(var(--space-5) * -1);
  background: var(--surface-espresso); color: var(--ink-inverse);
  text-align: center; padding: var(--space-12) var(--space-5) var(--space-12);
  display: grid; gap: var(--space-5); justify-items: center;
  animation: rise .6s ease both;
}
.result .serif-title { font-size: 44px; color: var(--ink-inverse); }
.result .lead { max-width: 320px; color: var(--surface-200); }
.code-box {
  width: 100%; max-width: 320px; border: 1px solid rgba(242, 217, 186, .45);
  padding: var(--space-5) var(--space-5) var(--space-6);
}
.code {
  font: 300 38px/1 var(--font-sans); letter-spacing: 0.12em; margin-top: 10px;
  color: var(--ink-inverse); user-select: all;
}
@keyframes rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

.foot {
  text-align: center; color: var(--ink-muted);
  padding: var(--space-6) var(--space-5); border-top: 1px solid var(--hairline);
}
#confetti { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 10; }

@media (prefers-reduced-motion: reduce) {
  .result { animation: none; }
}
