:root {
  color-scheme: light;
  font-family: Inter, "Microsoft YaHei", sans-serif;
  background: #f5f7fb;
  color: #172033;
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; }
main { width: min(720px, calc(100% - 32px)); margin: 40px auto; }
.card {
  padding: 28px;
  border: 1px solid #e3e8f1;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 12px 34px rgba(33, 45, 75, .08);
}
h1 { margin: 0 0 8px; font-size: 26px; }
.description { margin: 0 0 22px; color: #667085; }
.status {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  margin-bottom: 20px;
  padding: 10px 14px;
  border-radius: 10px;
  background: #f2f4f7;
  color: #475467;
}
.status[data-state="active"] { background: #ecfdf3; color: #027a48; }
.status[data-state="error"] { background: #fef3f2; color: #b42318; }
.spinner {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
.spinner[hidden] { display: none; }
@keyframes spin { to { transform: rotate(360deg); } }
.fields { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: end; }
.fields[data-step="password"] #usernameField { grid-column: 1 / -1; }
.fields[data-step="otp"] #usernameField,
.fields[data-step="otp"] #passwordField { grid-column: 1 / -1; }
label { display: grid; gap: 7px; color: #344054; font-size: 14px; font-weight: 600; }
label[hidden] { display: none; }
label.full { grid-column: 1 / -1; }
input {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid #d0d5dd;
  border-radius: 9px;
  background: #fff;
  color: #101828;
  font: inherit;
  outline: none;
}
input:focus { border-color: #7f56d9; box-shadow: 0 0 0 3px rgba(127, 86, 217, .12); }
input:disabled { background: #f2f4f7; cursor: not-allowed; }
.footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 22px;
  color: #667085;
  font-size: 13px;
}
button {
  border: 0;
  border-radius: 9px;
  padding: 10px 14px;
  background: #e4e7ec;
  color: #344054;
  cursor: pointer;
  font: inherit;
  font-weight: 600;
}
button:disabled { cursor: not-allowed; opacity: .5; }
#confirmButton { background: #7f56d9; color: #fff; }
#lastResult { min-height: 20px; }
@media (max-width: 560px) {
  main { margin: 20px auto; }
  .card { padding: 20px; }
  .fields { grid-template-columns: 1fr; }
  label.full { grid-column: auto; }
  .footer { align-items: flex-start; flex-direction: column; }
}
