:root {
  color-scheme: light;
  --page: #f3f4f5;
  --page-glow: #ebedf0;
  --surface: #ffffff;
  --feature: #f2f3f5;
  --feature-deep: #e6e9ed;
  --feature-ink: #343b43;
  --ink: #242a30;
  --muted: #69717a;
  --line: #e0e4e8;
  --field: #fafbfc;
  --button: #333b44;
  --button-ink: #ffffff;
  --link: #3e505f;
  --success: #215c38;
  --success-bg: #edf7ed;
  --error: #a33f37;
  --error-bg: #fff1ed;
  --shadow:
    0 32px 90px rgba(29, 37, 46, 0.1), 0 5px 20px rgba(29, 37, 46, 0.04);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #111417;
  --page-glow: #1d2329;
  --surface: #1b1f23;
  --feature: #252b31;
  --feature-deep: #313941;
  --feature-ink: #e5e9ed;
  --ink: #eef0f2;
  --muted: #aab2ba;
  --line: #374047;
  --field: #252b30;
  --button: #e3e8ec;
  --button-ink: #1a2025;
  --link: #cbd9e5;
  --success: #b3e8bd;
  --success-bg: #223c29;
  --error: #ffb5a8;
  --error-bg: #4a2b2b;
  --shadow: 0 32px 100px rgba(0, 0, 0, 0.28), 0 4px 22px rgba(0, 0, 0, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--page);
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background: var(--page);
  font-family:
    Inter,
    ui-sans-serif,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  -webkit-font-smoothing: antialiased;
  transition:
    background-color 400ms ease,
    color 400ms ease;
}

button,
input {
  font: inherit;
}
button {
  cursor: pointer;
}
button:disabled {
  cursor: wait;
}
a {
  color: inherit;
}
[hidden] {
  display: none !important;
}

.page {
  display: grid;
  min-height: 100vh;
  padding: clamp(20px, 4.5vw, 64px);
  place-items: center;
  position: relative;
  isolation: isolate;
  overflow: hidden;
  background:
    radial-gradient(ellipse at 16% 16%, var(--page-glow) 0, transparent 37%),
    var(--page);
  transition: background 400ms ease;
}

.ambient {
  position: absolute;
  z-index: -1;
  width: 460px;
  height: 460px;
  border: 1px solid color-mix(in srgb, var(--feature-deep) 42%, transparent);
  border-radius: 50%;
  pointer-events: none;
}
.ambient-one {
  top: -290px;
  right: -65px;
}
.ambient-two {
  bottom: -300px;
  left: -130px;
  width: 620px;
  height: 620px;
}

.auth-shell {
  width: min(100%, 1060px);
  min-height: 686px;
  display: grid;
  grid-template-columns: minmax(0, 0.92fr) minmax(0, 1fr);
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--surface) 80%, var(--line));
  border-radius: 34px;
  background: var(--surface);
  box-shadow: var(--shadow);
  animation: shell-arrive 950ms cubic-bezier(0.18, 0.8, 0.22, 1) both;
  transition:
    background-color 400ms ease,
    border-color 400ms ease,
    box-shadow 400ms ease;
}

.feature-panel {
  position: relative;
  overflow: hidden;
  min-height: 686px;
  background: linear-gradient(145deg, var(--feature), var(--feature-deep));
  transition: background 400ms ease;
}
.feature-panel::after {
  content: "";
  position: absolute;
  right: -48%;
  bottom: -50%;
  width: 120%;
  aspect-ratio: 1;
  border: 1px solid color-mix(in srgb, var(--feature-ink) 10%, transparent);
  border-radius: 50%;
  pointer-events: none;
}

.form-panel {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 31px clamp(34px, 5.6vw, 69px) 26px;
}
.panel-topline {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  min-height: 33px;
}
.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border: 0;
  border-radius: 100px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  transition:
    color 180ms,
    background-color 180ms;
}
.theme-toggle:hover {
  color: var(--ink);
  background: var(--field);
}
.theme-toggle:focus-visible,
.text-link:focus-visible,
.inline-link:focus-visible,
.authenticator-link:focus-visible,
.manual-setup summary:focus-visible,
.copy-button:focus-visible,
.password-toggle:focus-visible {
  outline: 2px solid var(--link);
  outline-offset: 3px;
}
.theme-icon {
  width: 17px;
  height: 17px;
}
.icon-moon {
  display: none;
}
:root[data-theme="dark"] .icon-sun {
  display: none;
}
:root[data-theme="dark"] .icon-moon {
  display: block;
}

.form-content {
  width: 100%;
  max-width: 390px;
  margin: auto;
  padding: 31px 0 44px;
}
.intro {
  opacity: 1;
  transform: translateY(0);
  transition:
    opacity 260ms ease,
    transform 260ms ease;
}
.intro.is-leaving {
  opacity: 0;
  transform: translateY(-10px);
  pointer-events: none;
}
.intro.is-entering {
  opacity: 0;
  transform: translateY(12px);
}
.section-index {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.17em;
}
.index-line {
  width: 23px;
  height: 1px;
  background: var(--muted);
  opacity: 0.7;
}
h1 {
  min-height: 80px;
  margin: 15px 0 4px;
  font-size: clamp(54px, 5.6vw, 73px);
  font-weight: 550;
  letter-spacing: -0.08em;
  line-height: 1.1;
  outline: none;
}
h1.is-typing #title-text::after {
  content: "";
  display: inline-block;
  width: 2px;
  height: 0.76em;
  margin-left: 5px;
  background: var(--link);
  vertical-align: -0.08em;
  animation: caret 700ms step-end infinite;
}
h1[aria-label="Create account"],
h1[aria-label="Reset password"] {
  font-size: clamp(39px, 4.3vw, 52px);
  letter-spacing: -0.065em;
}
.intro-description {
  margin: 0 0 33px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}
.forms-stack {
  position: relative;
  min-height: 400px;
}
.forms-stack.is-busy .view {
  opacity: 0;
  pointer-events: none;
}
.task-progress {
  position: absolute;
  inset: 0;
  display: flex;
  min-height: 400px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 10px 42px;
  background: var(--surface);
  text-align: center;
  animation: progress-arrive 320ms ease both;
}
.progress-spinner {
  width: 53px;
  height: 53px;
  margin-bottom: 27px;
  border: 2px solid var(--line);
  border-top-color: var(--link);
  border-radius: 50%;
  animation: progress-spin 900ms linear infinite;
}
.progress-label {
  margin: 0 0 11px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.17em;
}
.task-progress h2 {
  margin: 0 0 9px;
  font-size: clamp(23px, 4.5vw, 29px);
  font-weight: 600;
  letter-spacing: -0.045em;
}
#task-progress-detail {
  max-width: 310px;
  min-height: 48px;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}
.progress-limit {
  max-width: 290px;
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}
.view {
  opacity: 1;
  transform: translateY(0);
  transition:
    opacity 260ms ease,
    transform 260ms ease;
}
.view.is-active.is-leaving {
  opacity: 0;
  transform: translateY(-10px);
  pointer-events: none;
}
.view.is-active.is-entering {
  opacity: 0;
  transform: translateY(12px);
}
.view.is-active {
  opacity: 1;
  transform: translateY(0);
}
.view.is-active .reveal {
  animation: field-arrive 620ms cubic-bezier(0.19, 0.75, 0.24, 1) both;
}
.view.is-active form > :nth-child(1) {
  animation-delay: 70ms;
}
.view.is-active form > :nth-child(2) {
  animation-delay: 125ms;
}
.view.is-active form > :nth-child(3) {
  animation-delay: 180ms;
}
.view.is-active form > :nth-child(4) {
  animation-delay: 235ms;
}
.view.is-active form > :nth-child(5) {
  animation-delay: 280ms;
}
.view.is-active form > :nth-child(6) {
  animation-delay: 320ms;
}
.view.is-active .switch-prompt {
  animation-delay: 390ms;
}
.view.is-active .enroll-panel {
  animation-delay: 70ms;
}
.register-stage {
  transition:
    opacity 260ms ease,
    transform 260ms ease;
}
.register-stage.is-active.is-leaving {
  opacity: 0;
  transform: translateY(-10px);
}
.register-stage.is-active.is-entering {
  opacity: 0;
  transform: translateY(12px);
}
.register-stage.is-active {
  opacity: 1;
  transform: translateY(0);
}

.field {
  margin-bottom: 19px;
}
.field label {
  display: block;
  margin: 0 0 9px;
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0.005em;
}
.field-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}
.field-heading label {
  margin-bottom: 9px;
}
.field input {
  display: block;
  width: 100%;
  min-height: 51px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 13px;
  outline: none;
  background: var(--field);
  color: var(--ink);
  font-size: 14px;
  transition:
    border-color 180ms,
    box-shadow 180ms,
    background-color 400ms;
}
.field input::placeholder {
  color: color-mix(in srgb, var(--muted) 74%, transparent);
  opacity: 1;
}
.field input:hover {
  border-color: color-mix(in srgb, var(--link) 36%, var(--line));
}
.field input:focus {
  border-color: var(--link);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--link) 14%, transparent);
}
.field input:user-invalid {
  border-color: var(--error);
}
.field-note {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}
.callback-context {
  margin: 0 0 18px;
  overflow-wrap: anywhere;
  font-size: 12px;
}
.password-wrap {
  position: relative;
}
.password-wrap input {
  padding-right: 72px;
}
.password-toggle {
  position: absolute;
  top: 50%;
  right: 10px;
  transform: translateY(-50%);
  padding: 8px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}
.password-toggle:hover {
  color: var(--ink);
}
.text-link,
.inline-link {
  padding: 0;
  border: 0;
  background: none;
  color: var(--link);
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
}
.text-link:hover,
.inline-link:hover {
  text-decoration: underline;
  text-underline-offset: 4px;
}
.inline-link {
  font-size: inherit;
}
.inline-link span {
  display: inline-block;
  margin-left: 1px;
  transition: transform 180ms ease;
}
.inline-link:hover span {
  transform: translate(2px, -2px);
}

.form-notice {
  margin: 12px 0 16px;
  padding: 12px 14px;
  border-radius: 10px;
  color: var(--error);
  background: var(--error-bg);
  font-size: 12px;
  line-height: 1.5;
}
.form-notice[data-kind="success"] {
  color: var(--success);
  background: var(--success-bg);
}
.form-notice[data-kind="info"] {
  color: var(--link);
  background: var(--field);
}
.primary-button {
  display: flex;
  width: 100%;
  min-height: 53px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 25px;
  padding: 7px 9px 7px 19px;
  border: 1px solid transparent;
  border-radius: 14px;
  background: var(--button);
  color: var(--button-ink);
  font-size: 13px;
  font-weight: 700;
  box-shadow: 0 9px 18px color-mix(in srgb, var(--button) 14%, transparent);
  transition:
    transform 220ms cubic-bezier(0.2, 0.8, 0.2, 1),
    box-shadow 220ms,
    opacity 180ms,
    background-color 400ms;
}
.primary-button:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 14px 25px color-mix(in srgb, var(--button) 21%, transparent);
}
.primary-button:active:not(:disabled) {
  transform: translateY(0);
}
.primary-button:focus-visible {
  outline: 2px solid var(--link);
  outline-offset: 3px;
}
.primary-button:disabled {
  opacity: 0.68;
}
.button-arrow {
  display: grid;
  width: 37px;
  height: 37px;
  place-items: center;
  border-radius: 10px;
  background: color-mix(in srgb, var(--button-ink) 15%, transparent);
  font-size: 17px;
  font-weight: 400;
  transition: transform 220ms ease;
}
.primary-button:hover:not(:disabled) .button-arrow {
  transform: translate(2px, -2px);
}
.switch-prompt {
  margin: 25px 0 0;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.enroll-panel {
  margin: 2px 0 24px;
}
.enroll-icon {
  display: grid;
  width: 39px;
  height: 39px;
  place-items: center;
  border-radius: 11px;
  background: var(--feature);
  color: var(--feature-ink);
  font-size: 22px;
}
.enroll-panel h2 {
  margin: 16px 0 6px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 27px;
  font-weight: 400;
  letter-spacing: -0.04em;
}
.enroll-panel > p:not(.field-note) {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}
.authenticator-link {
  display: inline-flex;
  gap: 8px;
  margin: 15px 0;
  color: var(--link);
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
}
.authenticator-link:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}
.qr-box {
  display: grid;
  width: min(100%, 232px);
  margin: 18px auto 4px;
  padding: 8px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}
.totp-qr {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1;
}
.manual-setup {
  margin-top: 16px;
  padding: 12px 13px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--field);
}
.manual-setup summary {
  color: var(--link);
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
}
.secret-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 9px;
  margin-top: 12px;
}
.secret-row code {
  overflow-wrap: anywhere;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 12px;
  line-height: 1.55;
  letter-spacing: 0.05em;
}
.copy-button {
  flex: none;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font-size: 11px;
  font-weight: 700;
}
.copy-button:hover {
  border-color: var(--link);
}
@keyframes shell-arrive {
  from {
    opacity: 0;
    transform: translateY(22px) scale(0.984);
    filter: blur(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: blur(0);
  }
}
@keyframes field-arrive {
  from {
    opacity: 0;
    transform: translateY(17px) rotate(0.3deg);
    filter: blur(3px);
  }
  to {
    opacity: 1;
    transform: translateY(0) rotate(0);
    filter: blur(0);
  }
}
@keyframes caret {
  50% {
    opacity: 0;
  }
}
@keyframes progress-arrive {
  from {
    opacity: 0;
    transform: translateY(9px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
@keyframes progress-spin {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 780px) {
  .page {
    padding: 24px;
  }
  .auth-shell {
    grid-template-columns: minmax(0, 1fr);
    max-width: 520px;
    min-height: 0;
  }
  .feature-panel {
    display: none;
  }
  .form-panel {
    min-height: 660px;
    padding: 30px clamp(28px, 7vw, 55px) 25px;
  }
  .form-content {
    padding-top: 48px;
  }
}

@media (max-width: 520px) {
  .page {
    display: block;
    min-height: 100dvh;
    padding: 0;
  }
  .ambient {
    display: none;
  }
  .auth-shell {
    min-height: 100dvh;
    max-width: none;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }
  .form-panel {
    min-height: 100dvh;
    padding: 25px 26px 23px;
  }
  .form-content {
    padding: 61px 0 75px;
    margin: 0 auto;
  }
  h1 {
    font-size: 62px;
  }
  h1[aria-label="Create account"],
  h1[aria-label="Reset password"] {
    font-size: clamp(36px, 11vw, 43px);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-delay: 0ms !important;
    transition-duration: 0.01ms !important;
  }
  h1.is-typing #title-text::after {
    animation: none;
  }
}
