/* ================================================================
   Child Astrology — sign-in gate (e-mail + 6-digit code)
   Matches the reference mockup: centered, minimal, dark celestial.
   Uses the mockup logo (assets/auth-logo.jpg) and the mockup
   illustration (assets/auth-scene1.jpg / auth-scene2.jpg).
   Scoped under #auth-gate. CSP-safe: no external fonts / scripts.
   ================================================================ */

body.ca-auth-open{overflow:hidden;touch-action:none;}

#auth-gate{
  position:fixed;inset:0;z-index:2147483000;overflow:hidden;
  background:#06061a;color:#f4f1f8;
  font-family:system-ui,-apple-system,"Segoe UI",Roboto,sans-serif;
  -webkit-font-smoothing:antialiased;
}
#auth-gate[hidden]{display:none!important;}
#auth-gate *,#auth-gate *::before,#auth-gate *::after{box-sizing:border-box;}

#auth-gate .ag-language{
  position:absolute;z-index:2;top:calc(16px + env(safe-area-inset-top,0px));right:16px;
  display:flex;gap:5px;padding:4px;border:1px solid rgba(255,255,255,.14);border-radius:18px;
  background:rgba(6,6,26,.5);backdrop-filter:blur(8px);-webkit-backdrop-filter:blur(8px);
}
#auth-gate .ag-language button{
  min-width:34px;height:28px;padding:0 7px;border:0;border-radius:14px;background:transparent;
  color:#c2bcd6;font:600 11px/1 system-ui,-apple-system,"Segoe UI",Roboto,sans-serif;cursor:pointer;
}
#auth-gate .ag-language button.active{background:#e6c9a0;color:#2b2034;}
#auth-gate .ag-language button:focus-visible{outline:2px solid #f4ad92;outline-offset:2px;}

/* ---- backdrop ---- */
#auth-gate .ag-sky{
  position:absolute;inset:0;overflow:hidden;
  background:radial-gradient(140% 66% at 50% 0%,#232750 0%,#191d43 36%,#0d0d29 68%,#06061a 100%);
}
#auth-gate .ag-stars{position:absolute;inset:0;width:100%;height:100%;pointer-events:none;}

/* the mockup illustration, anchored to the bottom, faded into the sky at its top edge */
#auth-gate .ag-scene{
  position:absolute;left:0;right:0;bottom:0;height:40vh;min-height:264px;pointer-events:none;
  background:#0a0720 center bottom / cover no-repeat;
  background-image:url(assets/auth-scene1.jpg);
  -webkit-mask-image:linear-gradient(180deg,transparent 0,rgba(0,0,0,.5) 46px,#000 120px,#000 100%);
          mask-image:linear-gradient(180deg,transparent 0,rgba(0,0,0,.5) 46px,#000 120px,#000 100%);
}
#auth-gate.step-code .ag-scene{background-image:url(assets/auth-scene2.jpg);height:26vh;min-height:180px;}

@keyframes ag-tw{0%,100%{opacity:.2}50%{opacity:1}}
@keyframes ag-shake{10%,90%{transform:translateX(-1px)}20%,80%{transform:translateX(2px)}30%,50%,70%{transform:translateX(-4px)}40%,60%{transform:translateX(4px)}}

/* ---- step ---- */
#auth-gate .ag-step{
  position:absolute;inset:0;display:flex;flex-direction:column;align-items:center;text-align:center;
  padding:calc(40px + env(safe-area-inset-top,0px)) 26px calc(30px + env(safe-area-inset-bottom,0px));
  width:100%;max-width:420px;margin:0 auto;
}
#auth-gate .ag-step[hidden]{display:none!important;}

/* ---- brand logo (from the mockup) ---- */
#auth-gate .ag-logo{
  display:block;width:188px;height:auto;margin:0 auto;
  mix-blend-mode:lighten;
}

#auth-gate .ag-h1{
  margin:20px 0 0;font-weight:600;font-size:25px;line-height:1.32;letter-spacing:.005em;
  max-width:284px;text-wrap:balance;
}
#auth-gate .ag-sub{
  margin:14px 0 0;font-size:13.5px;line-height:1.62;color:#c2bcd6;max-width:298px;
}

/* ---- e-mail field ---- */
#auth-gate .ag-input{
  margin-top:28px;width:100%;height:54px;border-radius:27px;display:flex;align-items:center;
  padding:0 24px;background:rgba(255,255,255,.07);border:1px solid rgba(255,255,255,.17);
  backdrop-filter:blur(2px);-webkit-backdrop-filter:blur(2px);
  transition:border-color .15s,box-shadow .15s;
}
#auth-gate .ag-input:focus-within{border-color:#e8a184;box-shadow:0 0 0 3px rgba(232,161,132,.15);}
#auth-gate .ag-input input{
  flex:1;min-width:0;height:100%;border:0;background:none;outline:none;
  color:#f4f1f8;font-size:15px;font-family:inherit;text-align:left;
}
#auth-gate .ag-input input::placeholder{color:#9089a8;}

#auth-gate .ag-err{margin:10px 0 0;font-size:12.5px;color:#f4b199;min-height:16px;text-shadow:0 1px 3px rgba(0,0,0,.5);}

/* ---- primary button ---- */
#auth-gate .ag-cta{
  margin-top:auto;width:100%;height:56px;border:0;border-radius:28px;cursor:pointer;
  font-family:inherit;font-size:16px;font-weight:600;letter-spacing:.01em;color:#3a1c14;
  background:linear-gradient(180deg,#f4ad92 0%,#e78a6c 100%);
  box-shadow:0 14px 34px rgba(20,14,30,.5),0 4px 14px rgba(231,138,108,.3);
  transition:opacity .15s;
}
#auth-gate .ag-cta[disabled]{opacity:.6;cursor:default;}

/* ---- code step ---- */
#auth-gate .ag-back{
  position:absolute;top:calc(20px + env(safe-area-inset-top,0px));left:22px;
  width:30px;height:30px;display:flex;align-items:center;justify-content:center;
  background:none;border:0;cursor:pointer;padding:0;
}
#auth-gate .ag-mid{
  display:flex;flex-direction:column;align-items:center;gap:18px;margin-top:7vh;width:100%;
}
#auth-gate .ag-emblem{filter:drop-shadow(0 0 22px rgba(230,201,160,.34));}
#auth-gate .ag-body{margin:0;font-size:14px;line-height:1.6;color:#c2bcd6;}
#auth-gate .ag-body .ag-mail{display:inline-block;margin-top:4px;color:#e8a184;font-weight:600;}
#auth-gate .ag-codehint{margin:-4px 0 0;font-size:12px;line-height:1.5;color:#8f89ab;max-width:290px;}

#auth-gate .ag-otp{display:flex;gap:10px;justify-content:center;margin-top:4px;}
#auth-gate .ag-otp.err{animation:ag-shake .5s;}
#auth-gate .ag-otp input{
  width:44px;height:56px;border-radius:13px;text-align:center;
  font-size:22px;font-weight:600;color:#f4f1f8;font-family:inherit;
  background:rgba(255,255,255,.05);border:1px solid rgba(255,255,255,.17);outline:none;
  transition:border-color .15s,box-shadow .15s,background .15s;
}
#auth-gate .ag-otp input::placeholder{color:rgba(255,255,255,.2);}
#auth-gate .ag-otp input:focus{
  border-color:#e6c9a0;background:rgba(230,201,160,.06);
  box-shadow:0 0 0 3px rgba(230,201,160,.15),0 0 18px rgba(230,201,160,.28);
}
#auth-gate .ag-otp.ok input{border-color:#93d4a4;background:rgba(147,212,164,.08);color:#e6f4ea;}

#auth-gate .ag-resend{display:flex;flex-direction:column;align-items:center;gap:5px;margin-top:6px;font-size:13px;color:#a49ec0;}
#auth-gate .ag-resend button{
  background:none;border:0;padding:0;cursor:pointer;font:inherit;font-size:13.5px;font-weight:600;
  color:#e8a184;text-decoration:underline;text-underline-offset:3px;
}
#auth-gate .ag-resend button[disabled]{opacity:.45;cursor:default;text-decoration:none;}

@media (max-width:360px){
  #auth-gate .ag-otp input{width:40px;height:52px;font-size:20px;}
  #auth-gate .ag-h1{font-size:23px;}
  #auth-gate .ag-logo{width:168px;}
}
@media (prefers-reduced-motion:reduce){ #auth-gate *{animation:none!important;} }
