/* ============================================================
   Amigo Secreto — Cadastro (self-registration)
   Same festive language as the reveal landing:
   crimson gradient + CSS snow/glow, Huawei 28-anos chip,
   gold Lilita One titles, gold-framed light form card.
   ============================================================ */

:root {
  --red: #C7000B;
  --red-deep: #5c0009;
  --red-mid: #8f0f16;
  --gold: #FFD700;
  --gold-2: #D4AF37;
  --gold-deep: #8a6508;
  --cream: #FFF8E7;

  --font-display: 'Lilita One', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-body: 'Nunito', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mono: ui-monospace, 'SFMono-Regular', Menlo, Consolas, 'Liberation Mono', monospace;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }
[hidden] { display: none !important; }

html, body { min-height: 100%; }

body {
  margin: 0;
  min-height: 100dvh;
  color: var(--cream);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;

  background:
    radial-gradient(120% 90% at 50% -10%, #a5161d 0%, #8f0f16 30%, #6e0509 62%, #4a0206 100%);
  background-attachment: fixed;
}

/* ── Ambient background: snow drift + warm glow + vignette ── */
.fx {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}
.fx__snow {
  position: absolute;
  inset: -20% 0 -20% 0;
  background-image: radial-gradient(circle, rgba(255, 255, 255, .85) 1.3px, transparent 1.9px);
  background-size: 120px 120px;
  opacity: .30;
  animation: snowDrift 20s linear infinite;
}
.fx__snow::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle, rgba(255, 248, 231, .6) 1px, transparent 1.5px),
    radial-gradient(circle, rgba(255, 215, 0, .5) 1.4px, transparent 2px);
  background-size: 190px 190px, 260px 260px;
  background-position: 40px 60px, 130px 20px;
  opacity: .7;
  animation: snowDrift 34s linear infinite reverse;
}
@keyframes snowDrift {
  from { background-position: 0 0; }
  to   { background-position: 0 120px; }
}
.fx__glow {
  position: absolute;
  top: -10%;
  left: 50%;
  width: min(680px, 120vw);
  height: min(680px, 120vw);
  transform: translateX(-50%);
  background: radial-gradient(circle, rgba(255, 215, 0, .18) 0%, rgba(255, 215, 0, 0) 62%);
  animation: glowPulse 6s ease-in-out infinite;
}
@keyframes glowPulse {
  0%, 100% { opacity: .55; }
  50%      { opacity: 1; }
}
body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: radial-gradient(130% 100% at 50% 50%, rgba(0, 0, 0, 0) 55%, rgba(0, 0, 0, .45) 100%);
}

/* ── Page shell ──────────────────────────────────────────── */
.page {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  padding: clamp(18px, 4vw, 30px);
  padding-top: max(clamp(18px, 4vw, 30px), env(safe-area-inset-top));
  padding-bottom: max(clamp(22px, 4vw, 34px), env(safe-area-inset-bottom));
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(14px, 2.4vh, 22px);
}

.page__top { width: 100%; display: flex; }

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 4px;
  font-family: var(--font-body);
  font-weight: 800;
  font-size: .9rem;
  letter-spacing: .01em;
  color: rgba(255, 248, 231, .8);
  text-decoration: none;
  border-radius: 8px;
  transition: color .2s ease, transform .2s ease;
}
.back-link:hover { color: var(--gold); }
.back-link:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }

/* ── Header: chip, title, subtitle ───────────────────────── */
.page-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(10px, 2vh, 16px);
  text-align: center;
}

.brand-banner {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  max-width: min(86vw, 360px);
  padding: 12px 14px;
  background: #FFFFFF;
  border-radius: 14px;
  box-shadow:
    0 8px 24px rgba(0, 0, 0, .35),
    0 0 0 1px rgba(212, 175, 55, .55),
    0 0 22px rgba(255, 215, 0, .25);
}
.brand-banner__img {
  display: block;
  height: clamp(48px, 13vw, 56px);
  width: auto;
  max-width: 100%;
}

.page-title {
  margin: .1em 0 0;
  font-family: var(--font-display);
  font-size: clamp(2rem, 8.5vw, 3.3rem);
  line-height: .98;
  letter-spacing: .02em;
  background: linear-gradient(180deg, #FFF6C4 0%, var(--gold) 44%, #e8a800 78%, var(--gold) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 2px 0 rgba(90, 20, 0, .45)) drop-shadow(0 0 22px rgba(255, 215, 0, .45));
}
.page-subtitle {
  margin: 0;
  max-width: 34ch;
  font-size: clamp(.95rem, 3.6vw, 1.05rem);
  font-weight: 600;
  color: rgba(255, 248, 231, .88);
}

/* ── Light, gold-framed card ─────────────────────────────── */
.card {
  position: relative;
  width: 100%;
  color: #2a1410;
  background: linear-gradient(180deg, #FFFDF8 0%, #FFF1DC 100%);
  border: 2px solid var(--gold-2);
  border-radius: 22px;
  padding: clamp(20px, 5vw, 32px);
  box-shadow:
    0 16px 42px rgba(0, 0, 0, .42),
    0 0 32px rgba(255, 215, 0, .16),
    inset 0 1px 0 rgba(255, 255, 255, .8);
  animation: cardIn .5s cubic-bezier(.2, .8, .25, 1) both;
}
@keyframes cardIn {
  from { opacity: 0; transform: translateY(14px) scale(.99); }
  to   { opacity: 1; transform: none; }
}
.card--success,
.card--closed { text-align: center; }

/* ── Form ────────────────────────────────────────────────── */
.field { margin-top: 16px; }
.field:first-child { margin-top: 0; }
.field__label {
  display: block;
  margin-bottom: 6px;
  font-family: var(--font-body);
  font-weight: 800;
  font-size: .9rem;
  letter-spacing: .01em;
  color: #5a2a12;
}
.input {
  width: 100%;
  padding: 13px 14px;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 1rem;
  color: #2a1410;
  background: #ffffff;
  border: 1.5px solid rgba(199, 0, 11, .28);
  border-radius: 12px;
  outline: none;
  transition: border-color .2s ease, box-shadow .2s ease;
}
.input::placeholder { color: #b08a6a; font-weight: 600; }
.input:focus { border-color: var(--gold-2); box-shadow: 0 0 0 3px rgba(255, 215, 0, .3); }
.input.is-invalid { border-color: var(--red); box-shadow: 0 0 0 3px rgba(199, 0, 11, .16); }

.hint { margin: 7px 0 0; font-size: .8rem; font-weight: 700; color: #8a5a3a; }
.hint b { color: #5a2a12; }
.error { margin: 7px 0 0; font-size: .82rem; font-weight: 800; color: var(--red); }

/* ── Gold button ─────────────────────────────────────────── */
.btn-gold {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 56px;
  padding: 16px 26px;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(1.02rem, 4vw, 1.24rem);
  letter-spacing: .05em;
  text-transform: uppercase;
  text-align: center;
  text-decoration: none;
  color: #5a1a00;
  background: linear-gradient(180deg, #FFE874 0%, var(--gold) 38%, var(--gold-2) 70%, #b8860b 100%);
  border: none;
  border-radius: 999px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  box-shadow:
    0 6px 0 var(--gold-deep),
    0 10px 22px rgba(0, 0, 0, .35),
    inset 0 2px 0 rgba(255, 255, 255, .7),
    inset 0 -6px 14px rgba(138, 101, 8, .5);
  transition: transform .12s ease, filter .2s ease, box-shadow .2s ease;
}
.btn-gold:hover { filter: brightness(1.05); }
.btn-gold:active:not(:disabled) {
  transform: translateY(3px);
  box-shadow: 0 3px 0 var(--gold-deep), 0 6px 16px rgba(0, 0, 0, .35), inset 0 2px 0 rgba(255, 255, 255, .6);
}
.btn-gold:focus-visible { outline: 3px solid rgba(255, 248, 231, .85); outline-offset: 3px; }
.btn-gold:disabled { cursor: not-allowed; filter: grayscale(.25) brightness(.92); opacity: .72; }

.btn-gold--block { width: 100%; margin-top: 22px; }
.btn-home { display: inline-flex; margin-top: 20px; }

/* ── Success / closed states ─────────────────────────────── */
.result { display: flex; flex-direction: column; align-items: center; }

.result__label {
  margin: 0;
  font-family: var(--font-body);
  font-weight: 900;
  font-size: .82rem;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: #7a4a2a;
}

/* big gold gift-tag code box */
.code-tag {
  position: relative;
  display: block;
  width: 100%;
  max-width: 360px;
  margin: 14px auto 0;
  padding: clamp(18px, 5vw, 28px) clamp(16px, 4vw, 24px);
  background: linear-gradient(180deg, #FFE874 0%, var(--gold) 46%, #D9A520 100%);
  border: 3px dashed var(--red);
  border-radius: 18px;
  box-shadow:
    0 12px 28px rgba(0, 0, 0, .4),
    0 0 26px rgba(255, 215, 0, .35),
    inset 0 0 20px rgba(255, 255, 255, .5);
}
.code-tag__value {
  display: block;
  font-family: var(--mono);
  font-weight: 900;
  font-size: clamp(1.7rem, 10vw, 2.8rem);
  line-height: 1.05;
  letter-spacing: .18em;
  padding-left: .18em; /* balance trailing letter-spacing */
  color: var(--red);
  text-shadow: 0 1px 0 rgba(255, 255, 255, .55);
  white-space: nowrap;
}

.result__msg {
  margin: 18px 0 0;
  font-size: .98rem;
  font-weight: 700;
  line-height: 1.5;
  color: #4a2410;
}
.result__hint {
  margin: 10px 0 0;
  font-size: .9rem;
  font-weight: 700;
  color: #7a4a2a;
}

.closed__title {
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 6vw, 2.1rem);
  letter-spacing: .02em;
  color: #8a2b12;
}

/* ── Toast ───────────────────────────────────────────────── */
.toast {
  position: fixed;
  left: 50%;
  bottom: max(24px, env(safe-area-inset-bottom));
  transform: translate(-50%, 14px);
  z-index: 90;
  max-width: 88vw;
  padding: 12px 20px;
  text-align: center;
  font-weight: 800;
  font-size: .92rem;
  color: var(--cream);
  background: rgba(20, 0, 3, .94);
  border: 1px solid rgba(255, 215, 0, .45);
  border-radius: 14px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .5);
  opacity: 0;
  pointer-events: none;
  transition: opacity .3s ease, transform .3s ease;
}
.toast.is-show { opacity: 1; transform: translate(-50%, 0); }

/* ── Responsive tuning ───────────────────────────────────── */
@media (min-width: 820px) {
  .page { max-width: 600px; }
}

@media (max-width: 360px) {
  .brand-banner { padding: 10px 12px; }
  .card { padding: 18px; border-radius: 20px; }
}

/* short landscape phones */
@media (max-height: 620px) and (orientation: landscape) {
  .page { min-height: auto; padding-top: 16px; padding-bottom: 16px; }
  .page-title { font-size: clamp(1.6rem, 5vw, 2.2rem); }
}

/* ── Reduced motion ──────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .fx__snow,
  .fx__snow::after,
  .fx__glow,
  .card {
    animation: none !important;
  }
  .btn-gold { transition: none; }
  .toast { transition: opacity .2s ease; }
}
