* { box-sizing: border-box; }
:root {
  color-scheme: dark;
  --text: #fff;
  --muted: rgba(255,255,255,.72);
  --accent: #a66af2;
  --accent-bright: #bd8aff;
  --card: rgba(25, 22, 34, .79);
}
html, body { width: 100%; min-height: 100%; margin: 0; }
body {
  min-height: 100vh;
  overflow: hidden;
  font-family: Inter, Arial, sans-serif;
  color: var(--text);
  background: #21142f;
}
button, input { font: inherit; }
.page-shell {
  position: relative; display: grid; place-items: center;
  min-height: 100vh; padding: 32px 20px 76px; isolation: isolate;
  overflow: hidden;
  background:
    linear-gradient(116deg, rgba(25, 12, 42, .18) 0%, transparent 38%, rgba(12, 18, 47, .24) 100%),
    linear-gradient(135deg, #32164b 0%, #4b236c 48%, #292044 100%);
}
.ambient { position: absolute; z-index: -2; pointer-events: none; }
.ambient-one {
  inset: 0;
  opacity: .24;
  background:
    linear-gradient(145deg, transparent 0 29%, rgba(202,169,235,.08) 29.1%, transparent 29.4% 100%),
    linear-gradient(28deg, transparent 0 61%, rgba(15,10,31,.12) 61.1%, transparent 61.5% 100%);
}
.ambient-two {
  width: 78vw; height: 78vw; right: -40vw; top: -46vw;
  border: 1px solid rgba(255,255,255,.055); border-radius: 50%;
  box-shadow: 0 0 0 46px rgba(255,255,255,.018), 0 0 0 92px rgba(255,255,255,.012);
}
.ambient-three {
  width: 62vw; height: 62vw; left: -40vw; bottom: -48vw;
  border: 1px solid rgba(255,255,255,.045); border-radius: 50%;
  box-shadow: 0 0 0 38px rgba(255,255,255,.014), 0 0 0 76px rgba(255,255,255,.01);
}
.grain {
  position: absolute; inset: 0; z-index: -1; pointer-events: none; opacity: .11;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.82' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.3'/%3E%3C/svg%3E");
  mix-blend-mode: soft-light;
}
.login-card {
  width: min(774px, 100%); min-height: 432px; position: relative;
  display: flex; align-items: center; justify-content: center;
  padding: 54px clamp(26px, 8vw, 100px);
  border: 1px solid rgba(255,255,255,.09);
  border-radius: 64px;
  background: var(--card);
  box-shadow: 0 30px 100px rgba(10, 5, 25, .25), inset 0 1px 0 rgba(255,255,255,.07);
  -webkit-backdrop-filter: blur(24px); backdrop-filter: blur(24px);
  animation: card-in .8s cubic-bezier(.2,.8,.2,1) both;
}
.card-content { width: 100%; max-width: 398px; position: relative; }
.back-link {
  position: absolute; top: -28px; left: -8px; display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 9px; border: 0; color: #a8dfff; background: transparent;
  cursor: pointer; font-size: 14px; transition: color .2s ease, transform .2s ease;
}
.back-link:hover { color: #fff; transform: translateX(-3px); }
.back-arrow { display: grid; place-items: center; width: 19px; height: 19px; border-radius: 50%; background: rgba(255,255,255,.18); font-size: 23px; line-height: 15px; }
.heading-group { text-align: center; margin: 0 0 34px; }
.eyebrow { margin: 0 0 14px; color: rgba(224,203,255,.76); letter-spacing: .24em; font-size: 10px; font-weight: 700; }
h1 { margin: 0; font-size: clamp(23px, 3vw, 26px); line-height: 1.25; font-weight: 650; letter-spacing: -.045em; }
.subtitle { margin: 14px 0 0; color: var(--muted); font-size: 14px; line-height: 1.6; }
form { width: 100%; }
input[type="email"], input[type="password"], .password-wrap input {
  width: 100%; height: 61px; padding: 0 24px; border: 1px solid transparent;
  border-radius: 17px; outline: none; color: #fff; background: rgba(255,255,255,.23);
  font-size: 14px; font-weight: 500; transition: border-color .25s ease, background .25s ease, box-shadow .25s ease;
}
input::placeholder { color: rgba(255,255,255,.65); }
input[type="email"]:focus, .password-wrap input:focus {
  border-color: rgba(194,145,255,.85); background: rgba(255,255,255,.27);
  box-shadow: 0 0 0 4px rgba(174,112,245,.13);
}
.primary-button {
  width: 155px; height: 53px; margin: 34px auto 0; display: flex; justify-content: center; align-items: center; gap: 12px;
  border: 1px solid rgba(255,255,255,.12); border-radius: 999px;
  color: #fff; background: linear-gradient(135deg, #8b42d0, #6930a9);
  box-shadow: 0 9px 24px rgba(68,24,112,.2);
  font-size: 15px; font-weight: 650; cursor: pointer;
  transition: transform .22s ease, box-shadow .22s ease, filter .22s ease, background .22s ease;
}
.primary-button:hover { transform: translateY(-3px); filter: brightness(1.12); box-shadow: 0 14px 30px rgba(111,51,171,.36); }
.primary-button:active { transform: translateY(0) scale(.97); }
.primary-button:focus-visible, .back-link:focus-visible, .visibility-button:focus-visible { outline: 2px solid #d6b5ff; outline-offset: 4px; }
.button-arrow { opacity: 0; width: 0; transform: translateX(-5px); transition: all .22s ease; }
.primary-button:hover .button-arrow { opacity: 1; width: 12px; transform: translateX(0); }
.field-error { min-height: 0; margin: 8px 4px 0; color: #ff8f9c; font-size: 12px; }
.field-error:empty { display: none; }
.step-panel { display: none; opacity: 0; transform: translateY(12px); }
.step-panel.active { display: block; animation: panel-in .42s cubic-bezier(.2,.8,.2,1) forwards; }
.password-heading { margin-bottom: 25px; }
.account-avatar {
  display: grid; place-items: center; width: 66px; height: 66px; margin: 0 auto 19px;
  border-radius: 50%; color: #fff; font-size: 26px; font-weight: 500;
  background: linear-gradient(145deg, #a55be9, #6428a5);
  box-shadow: 0 8px 25px rgba(104,45,166,.24);
}
.account-email { margin: 12px 0 0; color: rgba(255,255,255,.88); font-size: 14px; }
.password-wrap { position: relative; }
.password-wrap input { padding-right: 58px; }
.visibility-button {
  position: absolute; top: 50%; right: 17px; transform: translateY(-50%);
  width: 28px; height: 28px; padding: 3px; border: 0; background: transparent; color: rgba(255,255,255,.8); cursor: pointer;
}
.visibility-button svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.7; }
.remember-row { width: fit-content; display: flex; align-items: center; gap: 9px; margin: 18px auto 0; color: rgba(255,255,255,.9); font-size: 13px; cursor: pointer; user-select: none; }
.remember-row input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.custom-check { width: 16px; height: 16px; border-radius: 4px; border: 1px solid rgba(255,255,255,.58); background: rgba(255,255,255,.12); transition: .2s ease; }
.remember-row input:checked + .custom-check { border-color: #b985f6; background: #9b5bdf; box-shadow: inset 0 0 0 3px #38234d; }
.remember-row input:focus-visible + .custom-check { outline: 2px solid #d6b5ff; outline-offset: 3px; }
.password-heading + form .primary-button { margin-top: 26px; }
footer { position: absolute; left: 42px; bottom: 25px; color: rgba(255,255,255,.88); font-size: 14px; letter-spacing: -.01em; }
.toast {
  position: fixed; left: 50%; bottom: 76px; z-index: 5; max-width: calc(100% - 32px);
  padding: 12px 17px; border: 1px solid rgba(255,255,255,.13); border-radius: 12px;
  color: #fff; background: rgba(24,19,34,.94); box-shadow: 0 12px 35px rgba(0,0,0,.25);
  font-size: 13px; opacity: 0; pointer-events: none; transform: translate(-50%, 12px);
  transition: opacity .25s ease, transform .25s ease;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
[hidden] { display: none !important; }
@keyframes panel-in { to { opacity: 1; transform: translateY(0); } }
@keyframes card-in { from { opacity: 0; transform: translateY(18px) scale(.985); } to { opacity: 1; transform: translateY(0) scale(1); } }
@media (max-width: 640px) {
  body { overflow: auto; }
  .page-shell { min-height: 100svh; padding: 24px 16px 88px; }
  .login-card { min-height: 420px; padding: 62px 25px 48px; border-radius: 34px; }
  .card-content { max-width: 100%; }
  .back-link { top: -39px; left: -5px; }
  footer { left: 20px; right: 20px; bottom: 22px; text-align: center; font-size: 11px; }
  .subtitle { font-size: 13px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
