/* Dreamland — registro de contas. Tema medieval, sem imagens externas. */
:root {
  --night-1: #0b0d1a;
  --night-2: #1a1630;
  --night-3: #2b1d2e;
  --gold-1: #f6dd9a;
  --gold-2: #d4a64a;
  --gold-3: #8a6224;
  --ink: #2b1c10;
  --ink-soft: #5a4330;
  --parch-1: #f4e6c4;
  --parch-2: #e7d1a0;
  --parch-edge: #b48a4e;
  --wood-1: #5b3a1e;
  --wood-2: #3a2412;
  --blood: #8e1f1a;
  --blood-bg: #f6d6c8;
  --moss: #2f6b3a;
  --focus: #e0a530;
  --radius: 10px;
  --font-title: "Cinzel", "Trajan Pro", "Palatino Linotype", "Book Antiqua", Georgia, serif;
  --font-body: "EB Garamond", "Palatino Linotype", "Book Antiqua", Georgia, serif;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-body);
  font-size: 18px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--night-1);
  overflow-x: hidden;
}

/* ---------- cenário ---------- */
.sky {
  position: fixed;
  inset: 0;
  z-index: -3;
  background:
    radial-gradient(1px 1px at 12% 18%, #fff8 50%, transparent 51%),
    radial-gradient(1px 1px at 27% 8%, #fff6 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 44% 22%, #fff9 50%, transparent 51%),
    radial-gradient(1px 1px at 63% 12%, #fff7 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 78% 26%, #fff8 50%, transparent 51%),
    radial-gradient(1px 1px at 90% 9%, #fff6 50%, transparent 51%),
    radial-gradient(1px 1px at 8% 40%, #fff5 50%, transparent 51%),
    radial-gradient(1px 1px at 55% 35%, #fff5 50%, transparent 51%),
    radial-gradient(circle at 80% 12%, #f8e7b7 0 26px, #f8e7b733 27px, transparent 70px),
    radial-gradient(ellipse at 50% 120%, #6b2a1a88 0%, transparent 55%),
    linear-gradient(180deg, var(--night-1) 0%, var(--night-2) 45%, var(--night-3) 100%);
}

.castle {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: 38vh;
  z-index: -2;
  background: url("../images/castle.svg") center bottom / auto 100% repeat-x;
  opacity: .9;
  pointer-events: none;
}

.embers { position: fixed; inset: 0; z-index: -1; pointer-events: none; overflow: hidden; }
.embers span {
  position: absolute;
  bottom: -10px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #ffb347;
  box-shadow: 0 0 8px 2px #ff8c2a99;
  opacity: 0;
  animation: rise 14s linear infinite;
}
.embers span:nth-child(1) { left: 10%; animation-delay: 0s; }
.embers span:nth-child(2) { left: 25%; animation-delay: 3s; animation-duration: 17s; }
.embers span:nth-child(3) { left: 48%; animation-delay: 6s; }
.embers span:nth-child(4) { left: 66%; animation-delay: 1.5s; animation-duration: 19s; }
.embers span:nth-child(5) { left: 82%; animation-delay: 8s; }
.embers span:nth-child(6) { left: 93%; animation-delay: 4.5s; animation-duration: 16s; }

@keyframes rise {
  0% { transform: translate(0, 0) scale(1); opacity: 0; }
  10% { opacity: .9; }
  100% { transform: translate(40px, -95vh) scale(.4); opacity: 0; }
}

/* ---------- estrutura ---------- */
.stage {
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  padding: 28px 16px 40px;
}

.brand { text-align: center; margin-bottom: 18px; animation: fade-down .7s ease-out both; }
.crest { display: block; margin: 0 auto 6px; filter: drop-shadow(0 4px 12px #000a); }
.brand-name {
  margin: 0;
  font-family: var(--font-title);
  font-weight: 900;
  font-size: clamp(2.4rem, 9vw, 3.6rem);
  letter-spacing: .08em;
  line-height: 1.05;
  background: linear-gradient(180deg, var(--gold-1) 0%, var(--gold-2) 55%, var(--gold-3) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 2px 0 #0006;
  filter: drop-shadow(0 3px 6px #000c);
}
.brand-sub {
  margin: 4px 0 0;
  font-family: var(--font-title);
  font-size: .82rem;
  letter-spacing: .3em;
  text-transform: uppercase;
  color: #d9c79d;
}

/* ---------- pergaminho ---------- */
.scroll { position: relative; animation: unroll .6s .15s ease-out both; }
.scroll.wide { max-width: 720px; }

.scroll-rod {
  position: relative;
  height: 22px;
  margin: 0 -10px;
  border-radius: 11px;
  background: linear-gradient(180deg, #8a5a2c 0%, var(--wood-1) 35%, var(--wood-2) 100%);
  box-shadow: 0 4px 10px #0009, inset 0 1px 0 #c08a5277;
  z-index: 2;
}
.scroll-rod::before, .scroll-rod::after {
  content: "";
  position: absolute;
  top: -5px;
  width: 22px;
  height: 32px;
  border-radius: 6px;
  background: radial-gradient(circle at 40% 35%, var(--gold-1), var(--gold-2) 45%, var(--gold-3));
  box-shadow: 0 2px 6px #0008;
}
.scroll-rod::before { left: -8px; }
.scroll-rod::after { right: -8px; }

.parchment {
  position: relative;
  margin: -6px 0;
  padding: 34px clamp(18px, 6vw, 44px) 32px;
  color: var(--ink);
  background:
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='3' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 .35  0 0 0 0 .24  0 0 0 0 .12  0 0 0 .22 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>"),
    radial-gradient(ellipse at 50% 40%, transparent 55%, #9c743f55 100%),
    linear-gradient(180deg, var(--parch-1), var(--parch-2));
  box-shadow: inset 0 0 40px #8a5f2a66, 0 20px 50px #000c;
  border-left: 1px solid var(--parch-edge);
  border-right: 1px solid var(--parch-edge);
}
.parchment.center { text-align: center; }

.parchment h2 {
  margin: 0 0 4px;
  font-family: var(--font-title);
  font-weight: 700;
  font-size: 1.7rem;
  letter-spacing: .05em;
  text-align: center;
  color: #4a2a12;
}
.parchment h2::after {
  content: "";
  display: block;
  width: 140px;
  height: 10px;
  margin: 8px auto 0;
  background:
    radial-gradient(circle, var(--gold-3) 0 3px, transparent 4px) center / 10px 10px no-repeat,
    linear-gradient(90deg, transparent, var(--gold-3) 30%, var(--gold-3) 70%, transparent) center / 100% 1px no-repeat;
}
.lead { margin: 10px 0 22px; text-align: center; color: var(--ink-soft); font-style: italic; }

/* ---------- formulário ---------- */
.form { display: grid; gap: 16px; }

.field { display: grid; gap: 5px; }
.field label {
  font-family: var(--font-title);
  font-weight: 700;
  font-size: .9rem;
  letter-spacing: .06em;
  color: #4a2a12;
}

.field input[type="text"],
.field input[type="email"],
.field input[type="password"] {
  width: 100%;
  min-height: 46px;
  padding: 10px 14px;
  font: inherit;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 1rem;
  color: #1d140c;
  background: #fffaf0;
  border: 1px solid #a98455;
  border-radius: var(--radius);
  box-shadow: inset 0 2px 4px #6b4a2422;
  transition: border-color .15s, box-shadow .15s;
}
.field input::placeholder { color: #9b8466; }
.field input:focus {
  outline: none;
  border-color: var(--focus);
  box-shadow: 0 0 0 3px #e0a53055, inset 0 2px 4px #6b4a2422;
}
.field.has-error input { border-color: var(--blood); box-shadow: 0 0 0 3px #8e1f1a22; }
.field.is-valid input { border-color: var(--moss); }

.hint { color: var(--ink-soft); font-size: .88rem; line-height: 1.35; }
.error { color: var(--blood); font-size: .9rem; font-weight: 600; min-height: 0; }
.error:empty { display: none; }

.pw { position: relative; }
.pw input { padding-right: 52px; }
.pw-toggle {
  position: absolute;
  top: 50%;
  right: 6px;
  transform: translateY(-50%);
  width: 40px;
  height: 36px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
  font-size: 1.1rem;
  opacity: .65;
}
.pw-toggle:hover, .pw-toggle[aria-pressed="true"] { opacity: 1; background: #e7d1a0; }
.pw-toggle:focus-visible { outline: 2px solid var(--focus); }

.meter { height: 6px; border-radius: 3px; background: #d5bd8c; overflow: hidden; }
.meter span { display: block; height: 100%; width: 0; background: var(--blood); transition: width .25s, background-color .25s; }

.check .checkbox { display: flex; gap: 10px; align-items: flex-start; font-family: var(--font-body); font-size: 1rem; font-weight: 400; letter-spacing: 0; color: var(--ink); cursor: pointer; }
.check input { width: 20px; height: 20px; margin-top: 3px; accent-color: var(--wood-1); flex: none; }

a { color: #7a3e10; text-underline-offset: 3px; }
a:hover { color: var(--blood); }

/* campo-armadilha para robôs */
.hp { position: absolute !important; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

/* ---------- botão ---------- */
.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 52px;
  margin-top: 4px;
  padding: 12px 24px;
  font-family: var(--font-title);
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  text-decoration: none;
  color: #2b1806;
  text-shadow: 0 1px 0 #f9e3a466;
  background: linear-gradient(180deg, var(--gold-1) 0%, var(--gold-2) 48%, #b07f2f 52%, var(--gold-3) 100%);
  border: 2px solid #5a3a12;
  border-radius: 8px;
  box-shadow: inset 0 1px 0 #fff4, inset 0 -3px 0 #0003, 0 4px 0 #3b250c, 0 8px 18px #0006;
  cursor: pointer;
  transition: transform .08s, filter .15s, box-shadow .08s;
}
.btn:hover { filter: brightness(1.07); color: #2b1806; }
.btn:active { transform: translateY(3px); box-shadow: inset 0 1px 0 #fff4, inset 0 -2px 0 #0003, 0 1px 0 #3b250c, 0 4px 10px #0006; }
.btn:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
.btn .btn-busy { display: none; }
.btn.is-busy { cursor: progress; filter: saturate(.6); }
.btn.is-busy .btn-label { display: none; }
.btn.is-busy .btn-busy { display: inline; }
.btn[disabled] { pointer-events: none; }

/* ---------- mensagens ---------- */
.alert {
  padding: 12px 16px;
  color: #5e120e;
  background: var(--blood-bg);
  border: 1px solid #c4796a;
  border-left: 6px solid var(--blood);
  border-radius: var(--radius);
  font-weight: 600;
  animation: shake .35s ease-out;
}
.alert:focus { outline: none; }

.success { text-align: center; animation: fade-up .5s ease-out both; }
.success:focus { outline: none; }
.seal {
  width: 76px;
  height: 76px;
  margin: 0 auto 10px;
  display: grid;
  place-items: center;
  font-size: 2.2rem;
  font-weight: 700;
  color: #f8e3d0;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #c0392b, var(--blood) 60%, #5c110d);
  box-shadow: 0 4px 0 #4a0d0a, 0 8px 18px #0006, inset 0 0 0 5px #a3271f, inset 0 0 0 7px #d4574a55;
}
.success-lead { font-size: 1.1rem; }
.howto { margin: 18px 0; padding: 14px 18px; text-align: left; background: #fff6df; border: 1px dashed var(--parch-edge); border-radius: var(--radius); }
.howto div { display: flex; gap: 10px; padding: 4px 0; flex-wrap: wrap; }
.howto dt { min-width: 80px; font-family: var(--font-title); font-weight: 700; color: #4a2a12; }
.howto dd { margin: 0; overflow-wrap: anywhere; }
.note { font-style: italic; color: var(--ink-soft); }

.is-hidden { display: none !important; }

/* ---------- termos ---------- */
.terms h3 { margin: 22px 0 4px; font-family: var(--font-title); font-size: 1.05rem; color: #4a2a12; }
.terms p { margin: 0 0 8px; }
.terms .btn { margin-top: 22px; }

/* ---------- rodapé ---------- */
.foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 12px;
  margin-top: 26px;
  font-size: .95rem;
  color: #c9b48a;
  text-shadow: 0 1px 2px #000;
}
.foot a { color: #f0d79b; }

/* ---------- animações ---------- */
/* Só movimento, nunca opacidade 0: se o navegador não rodar a animação, o conteúdo continua visível. */
@keyframes fade-down { from { transform: translateY(-12px); } to { transform: none; } }
@keyframes fade-up { from { transform: translateY(12px); } to { transform: none; } }
@keyframes unroll { from { transform: scaleY(.96); } to { transform: none; } }
@keyframes shake { 0%, 100% { transform: none; } 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .embers { display: none; }
}

@media (max-width: 480px) {
  body { font-size: 17px; }
  .stage { padding-top: 18px; }
  .crest { width: 66px; height: 75px; }
  .scroll-rod { margin: 0 -4px; }
  .castle { height: 26vh; }
}
