:root {
  color-scheme: dark;
  --background: #080d1b;
  --surface: #111a2b;
  --surface-soft: #19243a;
  --surface-raised: #24314a;
  --text: #f2f5f6;
  --muted: #a6b1c8;
  --border: #344362;
  --primary: #4fd8cf;
  --blue: #648dff;
  --rose: #ff5f65;
}

* {
  box-sizing: border-box;
}

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

body {
  position: relative;
  overflow-x: hidden;
  margin: 0;
  color: var(--text);
  font-family:
    Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  background: linear-gradient(145deg, #080d18 0%, #0d1327 48%, #11132d 100%);
}

body::before {
  position: fixed;
  inset: 0;
  z-index: 0;
  content: "";
  pointer-events: none;
  background-image:
    linear-gradient(rgb(255 255 255 / 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgb(255 255 255 / 0.025) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: linear-gradient(to bottom, transparent, black 25%, black 75%, transparent);
}

body::after {
  position: fixed;
  inset: -18%;
  z-index: 0;
  content: "";
  pointer-events: none;
  opacity: 0.92;
  background:
    radial-gradient(circle at 18% 18%, rgb(79 216 207 / 0.34), transparent 32%),
    radial-gradient(circle at 78% 72%, rgb(157 115 255 / 0.34), transparent 35%),
    radial-gradient(circle at 68% 24%, rgb(100 141 255 / 0.24), transparent 29%),
    radial-gradient(circle at 32% 78%, rgb(237 76 167 / 0.16), transparent 27%);
  filter: saturate(1.22);
  transform: translate3d(-3%, -2%, 0) scale(1.06);
  animation: background-grade 16s ease-in-out infinite alternate;
}

.login-shell {
  position: relative;
  z-index: 1;
  display: grid;
  min-height: 100vh;
  min-height: 100svh;
  place-items: center;
  padding: 32px 20px;
}

.login-card {
  position: relative;
  width: min(100%, 430px);
  overflow: hidden;
  padding: 38px;
  border: 1px solid rgb(100 141 255 / 0.35);
  border-radius: 24px;
  background:
    linear-gradient(145deg, rgb(100 141 255 / 0.08), transparent 42%),
    rgb(17 26 43 / 0.94);
  box-shadow:
    0 30px 80px rgb(0 0 0 / 0.42),
    inset 0 1px rgb(255 255 255 / 0.04);
  backdrop-filter: blur(18px);
}

.login-card::before {
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  height: 3px;
  content: "";
  background: linear-gradient(90deg, var(--primary), var(--blue), #ed4ca7);
}

h1 {
  margin: 0;
  font-size: clamp(31px, 7vw, 40px);
  font-weight: 760;
  letter-spacing: -0.035em;
  line-height: 1.04;
}

form {
  display: grid;
  gap: 11px;
  margin-top: 30px;
}

label {
  color: #d8deeb;
  font-size: 13px;
  font-weight: 650;
}

input {
  width: 100%;
  height: 54px;
  padding: 0 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  outline: none;
  color: var(--text);
  font: inherit;
  background: var(--surface-soft);
  transition:
    border-color 140ms ease,
    box-shadow 140ms ease,
    background 140ms ease;
}

input:hover {
  border-color: #516382;
  background: #1d2941;
}

input:focus {
  border-color: var(--primary);
  box-shadow:
    0 0 0 3px rgb(79 216 207 / 0.15),
    0 0 24px rgb(79 216 207 / 0.08);
}

.form-error {
  margin: 0;
  color: #ffb3b6;
  font-size: 13px;
  line-height: 1.45;
}

.login-card--error {
  animation: invalid-password-shake 480ms cubic-bezier(0.36, 0.07, 0.19, 0.97);
}

button {
  width: 100%;
  min-height: 54px;
  margin-top: 7px;
  border: 0;
  border-radius: 12px;
  color: #071311;
  font: inherit;
  font-size: 16px;
  font-weight: 760;
  cursor: pointer;
  background: linear-gradient(135deg, #42d6ce, #6684ff 58%, #aa65ee);
  box-shadow: 0 13px 30px rgb(65 135 220 / 0.2);
  transition:
    transform 140ms ease,
    filter 140ms ease,
    box-shadow 140ms ease;
}

button:hover {
  filter: brightness(1.08);
  box-shadow: 0 16px 34px rgb(65 135 220 / 0.28);
  transform: translateY(-1px);
}

button:active {
  transform: translateY(0);
}

button:focus-visible {
  outline: 3px solid rgb(79 216 207 / 0.4);
  outline-offset: 3px;
}

@keyframes invalid-password-shake {
  0%,
  100% {
    transform: translateX(0);
  }

  18% {
    transform: translateX(-8px) rotate(-0.25deg);
  }

  36% {
    transform: translateX(7px) rotate(0.2deg);
  }

  54% {
    transform: translateX(-5px) rotate(-0.15deg);
  }

  72% {
    transform: translateX(3px) rotate(0.1deg);
  }
}

@keyframes background-grade {
  0% {
    opacity: 0.78;
    filter: hue-rotate(-16deg) saturate(1.12);
    transform: translate3d(-4%, -3%, 0) scale(1.06);
  }

  50% {
    opacity: 1;
    filter: hue-rotate(18deg) saturate(1.32);
    transform: translate3d(3%, 2%, 0) scale(1.14);
  }

  100% {
    opacity: 0.9;
    filter: hue-rotate(38deg) saturate(1.2);
    transform: translate3d(6%, -2%, 0) scale(1.09);
  }
}

@media (max-width: 520px) {
  .login-shell {
    padding: 18px;
  }

  .login-card {
    padding: 30px 24px;
    border-radius: 20px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }

  body::after,
  .login-card--error {
    animation: none;
  }
}
