:root {
  color-scheme: dark;
  --arthenfold-ink: #f8f8fb;
  --arthenfold-muted: #d7d1df;
  --arthenfold-violet: #8b39de;
  --arthenfold-violet-bright: #bc88fc;
  --arthenfold-glass: rgba(18, 12, 28, 0.55);
}

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

body {
  position: relative;
  isolation: isolate;
  overflow-x: hidden;
  color: var(--arthenfold-ink);
  background:
    radial-gradient(circle at 50% -8%, rgba(63, 10, 92, 0.78), transparent 45%),
    radial-gradient(circle at 94% 24%, rgba(105, 47, 200, 0.52), transparent 50%),
    radial-gradient(circle at 7% 73%, rgba(223, 40, 134, 0.36), transparent 48%),
    radial-gradient(circle at 54% 104%, rgba(184, 211, 59, 0.2), transparent 43%),
    linear-gradient(135deg, #0e0915 0%, #190b29 48%, #120a1c 100%);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body::before {
  position: fixed;
  inset: -18%;
  z-index: -2;
  content: "";
  pointer-events: none;
  background:
    radial-gradient(circle at 23% 22%, rgba(153, 0, 102, 0.34), transparent 31%),
    radial-gradient(circle at 80% 67%, rgba(113, 47, 196, 0.36), transparent 34%),
    radial-gradient(circle at 48% 55%, rgba(255, 0, 255, 0.12), transparent 36%);
  filter: blur(36px) saturate(1.35);
  animation: arthenfold-aurora 28s ease-in-out infinite alternate;
}

body::after {
  position: fixed;
  inset: 0;
  z-index: -1;
  content: "";
  pointer-events: none;
  opacity: 0.2;
  background-image:
    repeating-linear-gradient(118deg, transparent 0 23px, rgba(255, 255, 255, 0.018) 24px 25px),
    repeating-linear-gradient(28deg, transparent 0 31px, rgba(255, 255, 255, 0.012) 32px 33px);
}

#root {
  position: relative;
  z-index: 1;
}

header.MuiAppBar-root {
  color: var(--arthenfold-ink);
  background: rgba(13, 8, 21, 0.34);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.12);
  backdrop-filter: blur(20px) saturate(1.3);
  -webkit-backdrop-filter: blur(20px) saturate(1.3);
}

#first-factor-stage {
  min-height: calc(100vh - 64px);
  padding: 34px 16px 52px;
  align-items: center;
}

#first-factor-stage > .MuiContainer-root {
  width: min(430px, calc(100vw - 32px));
  padding: 38px 38px 24px;
  overflow: hidden;
  color: var(--arthenfold-ink);
  background:
    radial-gradient(120% 85% at 18% 8%, rgba(255, 255, 255, 0.16), transparent 69%),
    linear-gradient(145deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.025) 48%),
    var(--arthenfold-glass);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 28px;
  box-shadow:
    0 30px 80px rgba(0, 0, 0, 0.42),
    inset 0 1px 0 rgba(255, 255, 255, 0.2),
    inset 0 0 0 1px rgba(139, 57, 222, 0.06);
  backdrop-filter: blur(26px) saturate(1.42);
  -webkit-backdrop-filter: blur(26px) saturate(1.42);
}

#first-factor-stage > .MuiContainer-root::before {
  position: absolute;
  inset: 0 0 auto;
  height: 2px;
  content: "";
  background: linear-gradient(90deg, #df2886, #55d7ff 42%, #bc88fc 72%, #d5e615);
  opacity: 0.82;
}

#first-factor-stage img[alt="Logo"] {
  width: 92px;
  height: 92px;
  object-fit: contain;
  filter:
    brightness(1.35)
    saturate(1.12)
    drop-shadow(0 12px 24px rgba(78, 19, 166, 0.45))
    drop-shadow(0 0 18px rgba(188, 136, 252, 0.3));
}

#first-factor-stage h5 {
  margin-top: 10px;
  color: var(--arthenfold-ink);
  font-size: 1.72rem;
  font-weight: 650;
  letter-spacing: -0.035em;
}

#first-factor-stage h5::after {
  display: block;
  margin-top: 6px;
  color: var(--arthenfold-muted);
  content: "Arthenfold private services";
  font-size: 0.78rem;
  font-weight: 450;
  letter-spacing: 0.01em;
}

#first-factor-stage .MuiInputLabel-root,
#first-factor-stage .MuiFormControlLabel-label,
#first-factor-stage .MuiSvgIcon-root {
  color: var(--arthenfold-muted);
}

#first-factor-stage .MuiOutlinedInput-root {
  color: var(--arthenfold-ink);
  background: rgba(7, 4, 12, 0.28);
  border-radius: 13px;
  transition: background 160ms ease, box-shadow 160ms ease;
}

#first-factor-stage .MuiOutlinedInput-root:hover,
#first-factor-stage .MuiOutlinedInput-root.Mui-focused {
  background: rgba(10, 5, 17, 0.4);
}

#first-factor-stage .MuiOutlinedInput-root.Mui-focused {
  box-shadow: 0 0 0 3px rgba(139, 57, 222, 0.18);
}

#first-factor-stage .MuiOutlinedInput-notchedOutline {
  border-color: rgba(255, 255, 255, 0.17);
}

#first-factor-stage .MuiOutlinedInput-root:hover .MuiOutlinedInput-notchedOutline {
  border-color: rgba(188, 136, 252, 0.55);
}

#first-factor-stage .MuiOutlinedInput-root.Mui-focused .MuiOutlinedInput-notchedOutline {
  border-color: var(--arthenfold-violet-bright);
}

#sign-in-button {
  min-height: 48px;
  color: white;
  font-size: 0.88rem;
  font-weight: 700;
  letter-spacing: 0.055em;
  background: linear-gradient(105deg, #6122b6 0%, #8b39de 52%, #712fc4 100%);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 13px;
  box-shadow: 0 14px 34px rgba(64, 12, 115, 0.42), inset 0 1px 0 rgba(255, 255, 255, 0.2);
  transition: transform 160ms ease, filter 160ms ease, box-shadow 160ms ease;
}

#sign-in-button:hover {
  background: linear-gradient(105deg, #7130c6 0%, #9c4bea 52%, #7f3bd0 100%);
  box-shadow: 0 18px 38px rgba(64, 12, 115, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.25);
  filter: brightness(1.05);
  transform: translateY(-1px);
}

#reset-password-button,
#first-factor-stage a {
  color: var(--arthenfold-violet-bright);
}

#reset-password-button:hover,
#first-factor-stage a:hover {
  color: #d4b3ff;
}

#arthennet-apply-link {
  display: block;
  width: fit-content;
  margin: 18px auto 4px;
  padding: 9px 14px;
  border: 1px solid rgba(188, 136, 252, 0.28);
  border-radius: 999px;
  background: rgba(139, 57, 222, 0.08);
  font-size: 0.78rem;
  font-weight: 650;
  text-decoration: none;
}

#first-factor-stage a[href="https://www.authelia.com"] {
  color: rgba(231, 224, 240, 0.58);
  font-size: 0.68rem;
}

@keyframes arthenfold-aurora {
  from {
    transform: translate3d(-2%, -1%, 0) scale(1.02);
  }
  to {
    transform: translate3d(2%, 1%, 0) scale(1.08);
  }
}

@media (max-width: 520px) {
  header.MuiAppBar-root {
    background: rgba(13, 8, 21, 0.52);
  }

  #first-factor-stage {
    padding: 20px 12px 32px;
  }

  #first-factor-stage > .MuiContainer-root {
    width: min(100%, 410px);
    padding: 30px 24px 20px;
    border-radius: 23px;
  }

  #first-factor-stage img[alt="Logo"] {
    width: 78px;
    height: 78px;
  }
}

@media (prefers-reduced-motion: reduce) {
  body::before,
  #sign-in-button {
    animation: none;
    transition: none;
  }
}
