:root {
  color-scheme: dark;
  --auth-red: #d20a0a;
  --auth-red-bright: #f32121;
  --auth-red-dark: #8f0000;
  --auth-bg: #080808;
  --auth-card: rgba(18, 18, 18, 0.9);
  --auth-border: rgba(255, 255, 255, 0.09);
  --auth-muted: #8f8f8f;
  --auth-text: #f4f4f4;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--auth-bg);
}

body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input {
  font: inherit;
}

.auth-page {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  color: var(--auth-text);
  background:
    radial-gradient(circle at 50% 5%, rgba(155, 0, 0, 0.12), transparent 34%),
    linear-gradient(145deg, #060606 0%, #0b0b0b 52%, #070707 100%);
}

.auth-page::before {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  content: "";
  opacity: 0.32;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.018) 1px, transparent 1px);
  background-size: 36px 36px;
  mask-image: linear-gradient(to bottom, black, transparent 75%);
}

.auth-top-line {
  position: fixed;
  z-index: 10;
  top: 0;
  right: 0;
  left: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--auth-red-bright), transparent);
  box-shadow: 0 0 18px rgba(243, 33, 33, 0.75);
}

.auth-glow {
  position: fixed;
  z-index: 0;
  border-radius: 50%;
  pointer-events: none;
  filter: blur(2px);
}

.auth-glow--one {
  top: -260px;
  left: 50%;
  width: 560px;
  height: 560px;
  transform: translateX(-50%);
  background: radial-gradient(circle, rgba(210, 10, 10, 0.13), transparent 68%);
}

.auth-glow--two {
  right: -260px;
  bottom: -300px;
  width: 540px;
  height: 540px;
  background: radial-gradient(circle, rgba(130, 0, 0, 0.08), transparent 68%);
}

.auth-shell {
  position: relative;
  z-index: 1;
  display: flex;
  width: min(100% - 32px, 440px);
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  padding: 64px 0 30px;
  flex-direction: column;
  justify-content: center;
}

.auth-shell--wide {
  width: min(100% - 32px, 500px);
  padding-top: 42px;
  padding-bottom: 24px;
}

.auth-brand {
  margin-bottom: 30px;
  text-align: center;
  animation: auth-rise 0.55s ease-out both;
}

.auth-brand--compact {
  margin-bottom: 22px;
}

.auth-brand-icon {
  display: grid;
  width: 68px;
  height: 68px;
  margin: 0 auto 18px;
  border: 1px solid rgba(243, 33, 33, 0.7);
  border-radius: 50%;
  color: #ff4b4b;
  background: linear-gradient(145deg, rgba(44, 5, 5, 0.92), rgba(14, 14, 14, 0.96));
  box-shadow: 0 0 0 7px rgba(210, 10, 10, 0.04), 0 12px 35px rgba(166, 0, 0, 0.2);
  place-items: center;
}

.auth-brand-icon svg {
  width: 30px;
  height: 30px;
}

.auth-eyebrow {
  margin: 0 0 7px;
  color: #e93434;
  font-size: 0.68rem;
  font-weight: 750;
  letter-spacing: 0.24em;
  text-transform: uppercase;
}

.auth-brand h1 {
  margin: 0;
  color: #fff;
  font-size: clamp(1.75rem, 6vw, 2.2rem);
  font-weight: 800;
  letter-spacing: -0.045em;
}

.auth-brand-copy {
  margin: 8px 0 0;
  color: var(--auth-muted);
  font-size: 0.88rem;
}

.auth-card {
  position: relative;
  overflow: hidden;
  padding: 34px;
  border: 1px solid var(--auth-border);
  border-radius: 26px;
  background: var(--auth-card);
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.5), inset 0 1px rgba(255, 255, 255, 0.025);
  backdrop-filter: blur(18px);
  animation: auth-rise 0.55s 0.08s ease-out both;
}

.auth-card::before {
  position: absolute;
  top: 0;
  right: 23%;
  left: 23%;
  height: 1px;
  content: "";
  background: linear-gradient(90deg, transparent, rgba(255, 49, 49, 0.9), transparent);
  box-shadow: 0 0 14px rgba(243, 33, 33, 0.4);
}

.auth-card-heading {
  margin-bottom: 27px;
  text-align: center;
}

.auth-card-heading h2 {
  margin: 0;
  color: #fff;
  font-size: 1.32rem;
  font-weight: 720;
  letter-spacing: -0.025em;
}

.auth-card-heading p {
  margin: 7px 0 0;
  color: var(--auth-muted);
  font-size: 0.83rem;
}

.auth-messages {
  display: grid;
  margin-bottom: 21px;
  gap: 9px;
}

.auth-alert {
  display: flex;
  align-items: flex-start;
  padding: 11px 12px;
  border: 1px solid rgba(255, 67, 67, 0.22);
  border-radius: 11px;
  color: #ff9c9c;
  background: rgba(164, 0, 0, 0.12);
  font-size: 0.79rem;
  line-height: 1.4;
  gap: 9px;
}

.auth-alert--success {
  border-color: rgba(51, 211, 153, 0.24);
  color: #91e7c2;
  background: rgba(10, 116, 78, 0.12);
}

.auth-alert--info,
.auth-alert--message {
  border-color: rgba(96, 165, 250, 0.22);
  color: #9fc7ff;
  background: rgba(19, 82, 160, 0.12);
}

.auth-alert svg {
  width: 17px;
  height: 17px;
  margin-top: 1px;
  flex: 0 0 auto;
}

.auth-field {
  margin-bottom: 18px;
}

.auth-field label {
  display: block;
  margin: 0 0 8px;
  color: #bdbdbd;
  font-size: 0.76rem;
  font-weight: 650;
  letter-spacing: 0.015em;
}

.auth-input-wrap {
  position: relative;
}

.auth-input-icon {
  position: absolute;
  z-index: 1;
  top: 50%;
  left: 15px;
  width: 18px;
  height: 18px;
  color: #666;
  pointer-events: none;
  transform: translateY(-50%);
  transition: color 0.2s ease;
}

.auth-input-wrap input {
  width: 100%;
  height: 50px;
  padding: 0 46px;
  border: 1px solid #292929;
  outline: 0;
  border-radius: 12px;
  color: #f6f6f6;
  background: rgba(7, 7, 7, 0.72);
  caret-color: #ff3636;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.auth-input-wrap input::placeholder {
  color: #555;
}

.auth-input-wrap input:focus {
  border-color: rgba(232, 28, 28, 0.8);
  background: rgba(9, 9, 9, 0.92);
  box-shadow: 0 0 0 3px rgba(210, 10, 10, 0.1), 0 8px 24px rgba(0, 0, 0, 0.2);
}

.auth-input-wrap:focus-within .auth-input-icon {
  color: #ec3535;
}

.auth-password-toggle {
  position: absolute;
  z-index: 2;
  top: 50%;
  right: 8px;
  display: grid;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: 9px;
  color: #707070;
  background: transparent;
  cursor: pointer;
  transform: translateY(-50%);
  place-items: center;
  transition: color 0.2s ease, background 0.2s ease;
}

.auth-password-toggle:hover,
.auth-password-toggle:focus-visible {
  color: #d5d5d5;
  background: rgba(255, 255, 255, 0.055);
  outline: 0;
}

.auth-password-toggle svg {
  width: 18px;
  height: 18px;
}

.auth-password-toggle [data-eye-closed] {
  display: none;
}

.auth-password-toggle[aria-pressed="true"] [data-eye-open] {
  display: none;
}

.auth-password-toggle[aria-pressed="true"] [data-eye-closed] {
  display: block;
}

.auth-submit {
  position: relative;
  display: flex;
  width: 100%;
  height: 51px;
  margin-top: 25px;
  padding: 0 18px;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border: 1px solid rgba(255, 70, 70, 0.42);
  border-radius: 12px;
  color: #fff;
  background: linear-gradient(110deg, #8e0000, #ce0a0a 48%, #b00000);
  background-size: 180% 100%;
  box-shadow: 0 10px 28px rgba(174, 0, 0, 0.23), inset 0 1px rgba(255, 255, 255, 0.13);
  cursor: pointer;
  font-size: 0.88rem;
  font-weight: 720;
  letter-spacing: 0.01em;
  transition: transform 0.18s ease, box-shadow 0.2s ease, background-position 0.25s ease;
}

.auth-submit:hover:not(:disabled) {
  background-position: 100% 0;
  box-shadow: 0 13px 33px rgba(204, 0, 0, 0.31), inset 0 1px rgba(255, 255, 255, 0.16);
  transform: translateY(-1px);
}

.auth-submit:active:not(:disabled) {
  transform: translateY(0);
}

.auth-submit:focus-visible {
  outline: 3px solid rgba(255, 51, 51, 0.25);
  outline-offset: 3px;
}

.auth-submit:disabled {
  cursor: wait;
  opacity: 0.72;
}

.auth-submit-arrow {
  position: absolute;
  right: 17px;
  width: 18px;
  height: 18px;
  opacity: 0.72;
  transition: transform 0.2s ease;
}

.auth-submit:hover .auth-submit-arrow {
  transform: translateX(3px);
}

.auth-spinner {
  display: none;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: auth-spin 0.7s linear infinite;
}

.auth-submit.is-loading [data-submit-label],
.auth-submit.is-loading .auth-submit-arrow {
  display: none;
}

.auth-submit.is-loading .auth-spinner {
  display: block;
}

.password-strength {
  margin-top: 9px;
}

.password-strength-bars {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  margin-bottom: 6px;
  gap: 5px;
}

.password-strength-bars span {
  height: 3px;
  border-radius: 99px;
  background: #272727;
  transition: background 0.2s ease, box-shadow 0.2s ease;
}

.password-strength[data-score="1"] span:nth-child(-n+1) { background: #d91e1e; }
.password-strength[data-score="2"] span:nth-child(-n+2) { background: #e77615; }
.password-strength[data-score="3"] span:nth-child(-n+3) { background: #d5ad1d; }
.password-strength[data-score="4"] span:nth-child(-n+4) { background: #24a66a; box-shadow: 0 0 8px rgba(36, 166, 106, 0.22); }

.password-strength small,
.password-match {
  color: #717171;
  font-size: 0.69rem;
  line-height: 1.4;
}

.password-match {
  display: block;
  min-height: 1em;
  margin-top: 7px;
}

.password-match.is-valid { color: #61c996; }
.password-match.is-invalid { color: #ff7b7b; }

.auth-separator {
  display: flex;
  margin: 23px 0 17px;
  align-items: center;
  color: #535353;
  font-size: 0.68rem;
  gap: 12px;
}

.auth-separator::before,
.auth-separator::after {
  height: 1px;
  background: #242424;
  content: "";
  flex: 1;
}

.auth-secondary-button {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid #292929;
  border-radius: 11px;
  color: #989898;
  background: transparent;
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 650;
  transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.auth-secondary-button:hover,
.auth-secondary-button:focus-visible {
  border-color: #444;
  outline: 0;
  color: #e0e0e0;
  background: rgba(255, 255, 255, 0.035);
}

.auth-footer {
  display: flex;
  margin-top: 25px;
  align-items: center;
  justify-content: center;
  color: #505050;
  font-size: 0.67rem;
  letter-spacing: 0.02em;
  animation: auth-rise 0.55s 0.16s ease-out both;
}

.auth-status-dot {
  width: 5px;
  height: 5px;
  margin-right: 8px;
  border-radius: 50%;
  background: #b40a0a;
  box-shadow: 0 0 7px rgba(230, 20, 20, 0.65);
}

@keyframes auth-rise {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes auth-spin {
  to { transform: rotate(360deg); }
}

@media (max-width: 540px) {
  .auth-shell,
  .auth-shell--wide {
    width: min(100% - 24px, 460px);
    padding-top: 34px;
    padding-bottom: 22px;
  }

  .auth-brand {
    margin-bottom: 22px;
  }

  .auth-brand-icon {
    width: 60px;
    height: 60px;
    margin-bottom: 15px;
  }

  .auth-card {
    padding: 28px 21px;
    border-radius: 22px;
  }

  .auth-card-heading {
    margin-bottom: 23px;
  }
}

@media (max-height: 720px) and (min-width: 541px) {
  .auth-shell {
    justify-content: flex-start;
    padding-top: 34px;
  }

  .auth-brand-icon {
    width: 58px;
    height: 58px;
    margin-bottom: 13px;
  }

  .auth-brand {
    margin-bottom: 20px;
  }
}

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